From 8bf0386136f3df96fc40fb73a6bff4f84b960fb4 Mon Sep 17 00:00:00 2001 From: Tiago Lopes Date: Sat, 18 Dec 2021 10:58:03 -0300 Subject: [PATCH] updated Dockerfile --- Dockerfile | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index d2d1337..21980a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,12 @@ -FROM alpine:3.14 +ARG ALPINE_VERSION=3.14 +FROM alpine:${ALPINE_VERSION} LABEL Maintainer="Tim de Pater " 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