From 45d0eb04a09f8617c39f7db9ccd5137b4c5f8ad2 Mon Sep 17 00:00:00 2001 From: Aleksander Cynarski Date: Mon, 5 Apr 2021 14:38:07 +0200 Subject: [PATCH] php composer script (check php versions) --- Dockerfile | 10 +++++----- docker/tools/install_composer.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100755 docker/tools/install_composer.sh diff --git a/Dockerfile b/Dockerfile index fe66ec8..00b9d12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,9 +80,11 @@ COPY --from=base-config /etc/supervisor /etc/supervisor COPY --from=builder /usr/local/lib/php /usr/local/lib/php COPY --from=builder /usr/local/etc /usr/local/etc -#install composer (v2 with parallel downloads) -RUN wget -O /bin/composer https://getcomposer.org/composer.phar -RUN chmod a+x /bin/composer +# Copy docker tools +COPY docker/tools /usr/local/bin/ + +#install composer +RUN /usr/local/bin/install_composer.sh #install cachetool RUN wget -O /bin/cachetool http://gordalina.github.io/cachetool/downloads/cachetool.phar @@ -100,8 +102,6 @@ WORKDIR $DIR # Copy base configuration files COPY docker/etc /etc/ -# Copy docker tools -COPY docker/tools /usr/local/bin/ EXPOSE 80 diff --git a/docker/tools/install_composer.sh b/docker/tools/install_composer.sh new file mode 100755 index 0000000..0c3b8af --- /dev/null +++ b/docker/tools/install_composer.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +PHP_VERSION=`php -r 'echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;'` + + +if [ $PHP_VERSION = '72' ]; then + wget -O /bin/composer https://getcomposer.org/composer-1.phar +else + wget -O /bin/composer https://getcomposer.org/composer.phar +fi + +chmod a+x /bin/composer + + +if [ $PHP_VERSION = '72' ]; then + composer global require hirak/prestissimo +fi \ No newline at end of file