From 99ed24c434361d7ffce82510120f7d3bf2d13da3 Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:42:03 +0100 Subject: [PATCH 1/7] update image version to 8.1 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5fa565d..69f6b4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.0-fpm-alpine +FROM php:8.1-fpm-alpine ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \ PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ From f69cca2be59a6d536e61187f23d781fa3bdb8916 Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:46:38 +0100 Subject: [PATCH 2/7] move file copies to the top --- Dockerfile | 57 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69f6b4e..af3f8e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,33 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \ PHP_FPM_PM="ondemand" \ PHP_FPM_PROCESS_IDLE_TIMEOUT="10s" +# create working dir +RUN mkdir /opt/app +WORKDIR /opt/app + +# install wait-for-it +ADD https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/wait-for-it.sh + +# copy runit services +COPY ./etc/service/ /etc/service/ +RUN find /etc/service/ -name "run" -exec chmod -v +x {} \; + +# copy nginx config files +COPY ./etc/nginx/conf.d/ /etc/nginx/conf.d/ +COPY ./etc/nginx/nginx.conf /etc/nginx/nginx.conf + +# copy php config files +COPY ./usr/local/etc/php/ /usr/local/etc/php/ +COPY ./usr/local/etc/php-fpm.d/ /usr/local/etc/php-fpm.d/ + +# copy bin files +COPY ./usr/local/bin/startup-commands.php /usr/local/bin/ + +# copy root folder and make run scripts executable +COPY ./root/ /root/ +RUN find /root -name "*.sh" -exec chmod -v +x {} \; + RUN apk info \ && apk update \ && apk upgrade \ @@ -66,31 +93,6 @@ RUN apk info \ RUN apk add gnu-libiconv=1.15-r3 --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ --allow-untrusted ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so -# change default shell -SHELL ["/bin/bash", "-c"] - -# create working dir -RUN mkdir /opt/app -WORKDIR /opt/app - -# install wait-for-it -ADD https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/wait-for-it.sh - -# copy runit services -COPY ./etc/service/ /etc/service/ -RUN find /etc/service/ -name "run" -exec chmod -v +x {} \; - -# copy nginx config files -COPY ./etc/nginx/conf.d/ /etc/nginx/conf.d/ -COPY ./etc/nginx/nginx.conf /etc/nginx/nginx.conf - -# copy php config files -COPY ./usr/local/etc/php/ /usr/local/etc/php/ -COPY ./usr/local/etc/php-fpm.d/ /usr/local/etc/php-fpm.d/ - -# copy bin files -COPY ./usr/local/bin/startup-commands.php /usr/local/bin/ # configure composer ENV COMPOSER_ALLOW_SUPERUSER=1 \ @@ -101,9 +103,8 @@ ENV COMPOSER_ALLOW_SUPERUSER=1 \ RUN yarn config set strict-ssl false && \ yarn global add cross-env -# copy root folder and make run scripts executable -COPY ./root/ /root/ -RUN find /root -name "*.sh" -exec chmod -v +x {} \; +# change default shell +SHELL ["/bin/bash", "-c"] # run the application ENTRYPOINT ["/root/entrypoint.sh"] From 56d3174e8592a060050f3cb6d104c0790ccdefc6 Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:49:20 +0100 Subject: [PATCH 3/7] install iconv in the same add statement as other packages --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index af3f8e9..715db7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ COPY ./root/ /root/ RUN find /root -name "*.sh" -exec chmod -v +x {} \; RUN apk info \ + && echo @iconv-fix http://dl-cdn.alpinelinux.org/alpine/v3.13/community >> /etc/apk/repositories \ && apk update \ && apk upgrade \ && apk add --no-cache --virtual .build-deps \ @@ -54,6 +55,7 @@ RUN apk info \ libpng-dev \ libxml2-dev \ freetype-dev \ + gnu-libiconv@iconv-fix=1.15-r3 \ bash \ git \ nodejs \ @@ -90,8 +92,6 @@ RUN apk info \ && rm -rf /tmp/* /var/cache/apk/* # fix iconv (see https://github.com/docker-library/php/issues/240#issuecomment-876464325) -RUN apk add gnu-libiconv=1.15-r3 --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ --allow-untrusted -ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so # configure composer @@ -99,6 +99,9 @@ ENV COMPOSER_ALLOW_SUPERUSER=1 \ COMPOSER_MEMORY_LIMIT=-1 \ PATH="$PATH:/opt/app/vendor/bin:~/.composer/vendor/bin" +# fix iconv (see https://github.com/docker-library/php/issues/240#issuecomment-876464325) +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so + # configure yarn RUN yarn config set strict-ssl false && \ yarn global add cross-env From 0e898a920ea434ee426084f8e153ad176d1bf0aa Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:51:59 +0100 Subject: [PATCH 4/7] pull composer from official docker image to prevent installation of unwanted php versions --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 715db7b..8ce1311 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,7 @@ RUN apk info \ git \ nodejs \ npm \ - composer \ + yarn \ mysql-client \ mariadb-connector-c \ php8-dom \ @@ -68,7 +68,6 @@ RUN apk info \ php8-xml \ php8-xmlwriter \ php8-fileinfo \ - yarn \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) \ gd \ @@ -91,8 +90,7 @@ RUN apk info \ && apk del .build-deps \ && rm -rf /tmp/* /var/cache/apk/* -# fix iconv (see https://github.com/docker-library/php/issues/240#issuecomment-876464325) - +COPY --from=composer /usr/bin/composer /usr/bin/composer # configure composer ENV COMPOSER_ALLOW_SUPERUSER=1 \ From 8679fb7680eccb5ddd46e0fbcd76ca51b7f5dc5c Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:52:48 +0100 Subject: [PATCH 5/7] remove duplicate and outdated extension installations --- Dockerfile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ce1311..83a37e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,11 +63,6 @@ RUN apk info \ yarn \ mysql-client \ mariadb-connector-c \ - php8-dom \ - php8-tokenizer \ - php8-xml \ - php8-xmlwriter \ - php8-fileinfo \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) \ gd \ @@ -78,12 +73,6 @@ RUN apk info \ intl \ opcache \ pcntl \ - iconv \ - xml \ - xmlwriter \ - dom \ - tokenizer \ - fileinfo \ && pecl install \ redis \ && docker-php-ext-enable redis \ From 49a83d1c213a969a40292298b00f4446746a89c6 Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Sat, 5 Feb 2022 23:53:01 +0100 Subject: [PATCH 6/7] reorder packages a bit --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 83a37e8..609cd7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,9 +45,6 @@ RUN apk info \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ && apk add --no-cache \ - sudo \ - runit \ - nginx \ zlib-dev \ icu-dev \ libzip-dev \ @@ -56,7 +53,10 @@ RUN apk info \ libxml2-dev \ freetype-dev \ gnu-libiconv@iconv-fix=1.15-r3 \ + sudo \ bash \ + runit \ + nginx \ git \ nodejs \ npm \ From a58f70baed30bea16b52912233ae595908dab27f Mon Sep 17 00:00:00 2001 From: Kevin Buchholz Date: Mon, 7 Feb 2022 10:32:37 +0100 Subject: [PATCH 7/7] remove php 8.1 update --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 609cd7b..18ac35e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-fpm-alpine +FROM php:8.0-fpm-alpine ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \ PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \