Add configuration to run apache containers as www-data user (#61)

- in preparation for changing the default to www-data,
   which will happen at some time in the future
This commit is contained in:
Markus Opolka
2021-05-09 11:35:41 +02:00
committed by GitHub
parent 74b3f31ee4
commit f1b7efb2d5
3 changed files with 13 additions and 3 deletions

View File

@@ -2,6 +2,8 @@ FROM php:7.4-apache
LABEL maintainer="markus@martialblog.de" LABEL maintainer="markus@martialblog.de"
ARG version='3.26.1+210427' ARG version='3.26.1+210427'
ARG sha256_checksum='25ed4c956e4b839db05178d7a38f508799a5ea2556b540fec04aeb750817b900' ARG sha256_checksum='25ed4c956e4b839db05178d7a38f508799a5ea2556b540fec04aeb750817b900'
ARG USER=root
ARG LISTEN_PORT=80
# Install OS dependencies # Install OS dependencies
RUN set -ex; \ RUN set -ex; \
@@ -71,9 +73,10 @@ RUN set -ex; \
\ \
tar xzvf "/tmp/limesurvey.tar.gz" --strip-components=1 -C /var/www/html/ && \ tar xzvf "/tmp/limesurvey.tar.gz" --strip-components=1 -C /var/www/html/ && \
rm -f "/tmp/limesurvey.tar.gz" && \ rm -f "/tmp/limesurvey.tar.gz" && \
chown -R www-data:www-data /var/www/html chown -R www-data:www-data /var/www/html /etc/apache2
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh entrypoint.sh
USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/var/www/html/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View File

@@ -2,6 +2,8 @@ FROM php:7.4-apache
LABEL maintainer="markus@martialblog.de" LABEL maintainer="markus@martialblog.de"
ARG version='4.5.2+210426' ARG version='4.5.2+210426'
ARG sha256_checksum='001c3e416e319d1b64e502620fa2a9a32e69d9b4db2f6376f4a6293b43a063ea' ARG sha256_checksum='001c3e416e319d1b64e502620fa2a9a32e69d9b4db2f6376f4a6293b43a063ea'
ARG USER=root
ARG LISTEN_PORT=80
# Install OS dependencies # Install OS dependencies
RUN set -ex; \ RUN set -ex; \
@@ -72,9 +74,10 @@ RUN set -ex; \
\ \
tar xzvf "/tmp/limesurvey.tar.gz" --strip-components=1 -C /var/www/html/ && \ tar xzvf "/tmp/limesurvey.tar.gz" --strip-components=1 -C /var/www/html/ && \
rm -f "/tmp/limesurvey.tar.gz" && \ rm -f "/tmp/limesurvey.tar.gz" && \
chown -R www-data:www-data /var/www/html chown -R www-data:www-data /var/www/html /etc/apache2
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh entrypoint.sh
USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/var/www/html/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View File

@@ -2,8 +2,12 @@
apache3: apache3:
docker build --pull -t martialblog/limesurvey:3-apache 3.0/apache docker build --pull -t martialblog/limesurvey:3-apache 3.0/apache
apache3-rootless:
docker build --pull --build-arg USER=www-data --build-arg LISTEN_PORT=8080 -t martialblog/limesurvey:3-apache-rootless 3.0/apache
apache4: apache4:
docker build --pull -t martialblog/limesurvey:4-apache 4.0/apache docker build --pull -t martialblog/limesurvey:3-apache 3.0/apache
apache4-rootless:
docker build --pull --build-arg USER=www-data --build-arg LISTEN_PORT=8080 -t martialblog/limesurvey:4-apache-rootless 4.0/apache
fpm-alpine3: fpm-alpine3:
docker build --pull -t martialblog/limesurvey:3-fpm-alpine 3.0/fpm-alpine docker build --pull -t martialblog/limesurvey:3-fpm-alpine 3.0/fpm-alpine
fpm-alpine4: fpm-alpine4: