updated Dockerfile

This commit is contained in:
Tiago Lopes
2021-12-18 10:58:03 -03:00
committed by Tim de Pater
parent 238f3db010
commit 8bf0386136
+9 -13
View File
@@ -1,9 +1,12 @@
FROM alpine:3.14
ARG ALPINE_VERSION=3.14
FROM alpine:${ALPINE_VERSION}
LABEL Maintainer="Tim de Pater <code@trafex.nl>"
LABEL Description="Lightweight container with Nginx 1.20 & PHP 8.0 based on Alpine Linux."
# Setup document root
WORKDIR /var/www/html
# Install packages and remove default server definition
RUN apk --no-cache add \
RUN apk add --no-cache --update \
curl \
nginx \
php8 \
@@ -22,8 +25,7 @@ RUN apk --no-cache add \
php8-session \
php8-xml \
php8-xmlreader \
php8-zlib \
supervisor
php8-zlib
# Create symlink so programs depending on `php` still function
RUN ln -s /usr/bin/php8 /usr/bin/php
@@ -35,23 +37,17 @@ COPY config/nginx.conf /etc/nginx/nginx.conf
COPY config/fpm-pool.conf /etc/php8/php-fpm.d/www.conf
COPY config/php.ini /etc/php8/conf.d/custom.ini
# Configure supervisord
# Install a golang port of supervisord and Configure
COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/bin/supervisord
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Setup document root
RUN mkdir -p /var/www/html
# Make sure files/folders needed by the processes are accessable when they run under the nobody user
RUN chown -R nobody.nobody /var/www/html && \
chown -R nobody.nobody /run && \
chown -R nobody.nobody /var/lib/nginx && \
chown -R nobody.nobody /var/log/nginx
RUN chown -R nobody.nobody /var/www/html /run /var/lib/nginx /var/log/nginx
# Switch to use a non-root user from here on
USER nobody
# Add application
WORKDIR /var/www/html
COPY --chown=nobody src/ /var/www/html/
# Expose the port nginx is reachable on