ARG ARCH= FROM ${ARCH}alpine:3.17 LABEL Maintainer="kerstin Sieren " \ Description="Lightweight container with Nginx & PHP-FPM based on Alpine Linux." # Install packages RUN apk --no-cache add \ php81 \ php81-fpm \ php81-opcache \ php81-pecl-apcu \ php81-mysqli \ php81-pgsql \ php81-json \ php81-openssl \ php81-curl \ php81-zlib \ php81-soap \ php81-xml \ php81-fileinfo \ php81-phar \ php81-intl \ php81-dom \ php81-xmlreader \ php81-ctype \ php81-session \ php81-iconv \ php81-tokenizer \ php81-zip \ php81-simplexml \ php81-mbstring \ php81-gd \ php81-mongodb \ nginx \ runit \ curl \ # Bring in gettext so we can get `envsubst`, then throw # the rest away. To do this, we need to install `gettext` # then move `envsubst` out of the way so `gettext` can # be deleted completely, then move `envsubst` back. && apk add --no-cache --virtual .gettext gettext \ && mv /usr/bin/envsubst /tmp/ \ && runDeps="$( \ scanelf --needed --nobanner /tmp/envsubst \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ | xargs -r apk info --installed \ | sort -u \ )" \ && apk add --no-cache $runDeps \ && apk del .gettext \ && mv /tmp/envsubst /usr/local/bin/ \ # Remove alpine cache && rm -rf /var/cache/apk/* \ # Remove default server definition && rm /etc/nginx/http.d/default.conf \ # Make sure files/folders needed by the processes are accessable when they run under the nobody user && chown -R nobody.nobody /run \ && chown -R nobody.nobody /var/lib/nginx \ && chown -R nobody.nobody /var/log/nginx # Add configuration files COPY --chown=nobody rootfs/ / # Switch to use a non-root user from here on USER nobody # Add application WORKDIR /var/www/html # Expose the port nginx is reachable on EXPOSE 8080 # Let runit start nginx & php-fpm CMD [ "/bin/docker-entrypoint.sh" ] # Configure a healthcheck to validate that everything is up&running HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping ENV client_max_body_size=2M \ clear_env=no \ allow_url_fopen=On \ allow_url_include=Off \ display_errors=Off \ file_uploads=On \ max_execution_time=0 \ max_input_time=-1 \ max_input_vars=1000 \ memory_limit=128M \ post_max_size=8M \ upload_max_filesize=2M \ zlib.output_compression=On