Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify Docker entrypoint using parameters #409

Merged
merged 1 commit into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ VOLUME ["/composer", "/build"]

CMD ["--ansi", "-vvv", "build", "/build/satis.json", "/build/output"]

ENTRYPOINT ["/sbin/tini", "--", "/satis/bin/satis"]
ENTRYPOINT ["/satis/bin/docker-entrypoint.sh"]
33 changes: 33 additions & 0 deletions bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
set -e

isCommand() {
for cmd in \
"add" \
"build" \
"help" \
"init" \
"list" \
"purge"
do
if [ -z "${cmd#"$1"}" ]; then
return 0
fi
done

return 1
}

# check if the first argument passed in looks like a flag
if [ "$(printf %c "$1")" = '-' ]; then
set -- /sbin/tini -- /satis/bin/satis "$@"
# check if the first argument passed in is satis
elif [ "$1" = 'satis' ]; then
shift
set -- /sbin/tini -- /satis/bin/satis "$@"
# check if the first argument passed in matches a known command
elif isCommand "$1"; then
set -- /sbin/tini -- /satis/bin/satis "$@"
fi

exec "$@"