From f352f1af2b461f107d1f46e1d5525f5306760119 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 16:07:05 -0400 Subject: [PATCH 1/2] Run php container as the `www-data` user to avoid permissions issues --- php-dev-craft/php-7.3/mariadb/Dockerfile | 3 +++ php-dev-craft/php-7.3/postgres/Dockerfile | 3 +++ php-dev-craft/php-7.4-alpine/mariadb/Dockerfile | 3 +++ php-dev-craft/php-7.4-alpine/postgres/Dockerfile | 3 +++ php-dev-craft/php-7.4/mariadb/Dockerfile | 3 +++ php-dev-craft/php-7.4/postgres/Dockerfile | 3 +++ php-dev-craft/php-8.0-alpine/mariadb/Dockerfile | 3 +++ php-dev-craft/php-8.0-alpine/postgres/Dockerfile | 3 +++ php-prod-craft/php-7.3/mariadb/Dockerfile | 3 +++ php-prod-craft/php-7.3/postgres/Dockerfile | 3 +++ php-prod-craft/php-7.4-alpine/mariadb/Dockerfile | 3 +++ php-prod-craft/php-7.4-alpine/postgres/Dockerfile | 3 +++ php-prod-craft/php-7.4/mariadb/Dockerfile | 3 +++ php-prod-craft/php-7.4/postgres/Dockerfile | 3 +++ php-prod-craft/php-8.0-alpine/mariadb/Dockerfile | 3 +++ php-prod-craft/php-8.0-alpine/postgres/Dockerfile | 3 +++ 16 files changed, 48 insertions(+) diff --git a/php-dev-craft/php-7.3/mariadb/Dockerfile b/php-dev-craft/php-7.3/mariadb/Dockerfile index 4f266bb..cb265e0 100755 --- a/php-dev-craft/php-7.3/mariadb/Dockerfile +++ b/php-dev-craft/php-7.3/mariadb/Dockerfile @@ -37,3 +37,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-7.3/postgres/Dockerfile b/php-dev-craft/php-7.3/postgres/Dockerfile index e55b2d0..2f57525 100755 --- a/php-dev-craft/php-7.3/postgres/Dockerfile +++ b/php-dev-craft/php-7.3/postgres/Dockerfile @@ -52,3 +52,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-7.4-alpine/mariadb/Dockerfile b/php-dev-craft/php-7.4-alpine/mariadb/Dockerfile index 9f1f64f..2587eca 100755 --- a/php-dev-craft/php-7.4-alpine/mariadb/Dockerfile +++ b/php-dev-craft/php-7.4-alpine/mariadb/Dockerfile @@ -55,3 +55,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-7.4-alpine/postgres/Dockerfile b/php-dev-craft/php-7.4-alpine/postgres/Dockerfile index 3c115c2..3edc846 100755 --- a/php-dev-craft/php-7.4-alpine/postgres/Dockerfile +++ b/php-dev-craft/php-7.4-alpine/postgres/Dockerfile @@ -57,3 +57,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-7.4/mariadb/Dockerfile b/php-dev-craft/php-7.4/mariadb/Dockerfile index cf6552b..1d1fba7 100755 --- a/php-dev-craft/php-7.4/mariadb/Dockerfile +++ b/php-dev-craft/php-7.4/mariadb/Dockerfile @@ -37,3 +37,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-7.4/postgres/Dockerfile b/php-dev-craft/php-7.4/postgres/Dockerfile index d76253b..0734e02 100755 --- a/php-dev-craft/php-7.4/postgres/Dockerfile +++ b/php-dev-craft/php-7.4/postgres/Dockerfile @@ -52,3 +52,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-8.0-alpine/mariadb/Dockerfile b/php-dev-craft/php-8.0-alpine/mariadb/Dockerfile index d4efb7a..6d390c7 100755 --- a/php-dev-craft/php-8.0-alpine/mariadb/Dockerfile +++ b/php-dev-craft/php-8.0-alpine/mariadb/Dockerfile @@ -55,3 +55,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-dev-craft/php-8.0-alpine/postgres/Dockerfile b/php-dev-craft/php-8.0-alpine/postgres/Dockerfile index bfdd036..5cfe1b0 100755 --- a/php-dev-craft/php-8.0-alpine/postgres/Dockerfile +++ b/php-dev-craft/php-8.0-alpine/postgres/Dockerfile @@ -57,3 +57,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/php-prod-craft/php-7.3/mariadb/Dockerfile b/php-prod-craft/php-7.3/mariadb/Dockerfile index d484d0d..ea3145e 100755 --- a/php-prod-craft/php-7.3/mariadb/Dockerfile +++ b/php-prod-craft/php-7.3/mariadb/Dockerfile @@ -41,6 +41,9 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-7.3/postgres/Dockerfile b/php-prod-craft/php-7.3/postgres/Dockerfile index aba74ab..a1c4585 100755 --- a/php-prod-craft/php-7.3/postgres/Dockerfile +++ b/php-prod-craft/php-7.3/postgres/Dockerfile @@ -56,6 +56,9 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-7.4-alpine/mariadb/Dockerfile b/php-prod-craft/php-7.4-alpine/mariadb/Dockerfile index bdec430..beaa5df 100755 --- a/php-prod-craft/php-7.4-alpine/mariadb/Dockerfile +++ b/php-prod-craft/php-7.4-alpine/mariadb/Dockerfile @@ -62,6 +62,9 @@ RUN chown -R www-data:www-data /var/www/project/cms/web WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-7.4-alpine/postgres/Dockerfile b/php-prod-craft/php-7.4-alpine/postgres/Dockerfile index 38db07b..6a9c485 100755 --- a/php-prod-craft/php-7.4-alpine/postgres/Dockerfile +++ b/php-prod-craft/php-7.4-alpine/postgres/Dockerfile @@ -64,6 +64,9 @@ RUN chown -R www-data:www-data /var/www/project/cms/web WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-7.4/mariadb/Dockerfile b/php-prod-craft/php-7.4/mariadb/Dockerfile index 15b10a6..13d2fc6 100755 --- a/php-prod-craft/php-7.4/mariadb/Dockerfile +++ b/php-prod-craft/php-7.4/mariadb/Dockerfile @@ -41,6 +41,9 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-7.4/postgres/Dockerfile b/php-prod-craft/php-7.4/postgres/Dockerfile index 4f70dc9..e689e7c 100755 --- a/php-prod-craft/php-7.4/postgres/Dockerfile +++ b/php-prod-craft/php-7.4/postgres/Dockerfile @@ -42,6 +42,9 @@ RUN apt-get update \ WORKDIR /var/www/project +# run container as the www-data user +USER www-data + COPY ./run_queue.sh . RUN chmod a+x run_queue.sh diff --git a/php-prod-craft/php-8.0-alpine/mariadb/Dockerfile b/php-prod-craft/php-8.0-alpine/mariadb/Dockerfile index c8b8b4c..4d2dfd4 100755 --- a/php-prod-craft/php-8.0-alpine/mariadb/Dockerfile +++ b/php-prod-craft/php-8.0-alpine/mariadb/Dockerfile @@ -62,6 +62,9 @@ RUN chown -R www-data:www-data /var/www/project/cms/web WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts diff --git a/php-prod-craft/php-8.0-alpine/postgres/Dockerfile b/php-prod-craft/php-8.0-alpine/postgres/Dockerfile index 35d4e75..0f75726 100755 --- a/php-prod-craft/php-8.0-alpine/postgres/Dockerfile +++ b/php-prod-craft/php-8.0-alpine/postgres/Dockerfile @@ -64,6 +64,9 @@ RUN chown -R www-data:www-data /var/www/project/cms/web WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts From 896a756f221b8f130cb4b3d96d6d2e9a9f70c036 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 16:07:18 -0400 Subject: [PATCH 2/2] Version 1.2.12 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f6c2f7..caeb9f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/docker-images Change Log +## 1.2.12 - 2021.05.23 +### Changed +* Run php container as the `www-data` user to avoid permissions issues + ## 1.2.11 - 2021.03.29 ### Added * Added support for webp to the GD PHP extension in `php-prod-base:8.0-alpine` & `php-prod-base:7.4-alpine`