Skip to content

Commit

Permalink
CLI-1168: Improve Dockerfile (#1618)
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored Oct 30, 2023
1 parent 45b30b9 commit b1a1914
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

14 changes: 14 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:8-alpine

RUN set -eux ; \
apk add --no-cache \
tini

RUN curl https://github.com/acquia/cli/releases/latest/download/acli.phar -L -o /usr/local/bin/acli \
&& chmod +x /usr/local/bin/acli

COPY docker-entrypoint.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

CMD ["acli"]
24 changes: 24 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

isCommand() {
# Retain backwards compatibility with common CI providers,
# see: https://github.com/composer/docker/issues/107
if [ "$1" = "sh" ]; then
return 1
fi

acli help --no-interaction "$1" > /dev/null 2>&1
}

# check if the first argument passed in looks like a flag
if [ "${1#-}" != "$1" ]; then
set -- /sbin/tini -- acli "$@"
# check if the first argument passed in is acli
elif [ "$1" = 'acli' ]; then
set -- /sbin/tini -- "$@"
# check if the first argument passed in matches a known command
elif isCommand "$1"; then
set -- /sbin/tini -- acli "$@"
fi

exec "$@"

0 comments on commit b1a1914

Please sign in to comment.