1- FROM alpine:3.14
1+ ARG ALPINE_VERSION=3.14
2+ FROM alpine:${ALPINE_VERSION}
23LABEL Maintainer="Tim de Pater <code@trafex.nl>"
34LABEL Description="Lightweight container with Nginx 1.20 & PHP 8.0 based on Alpine Linux."
5+ # Setup document root
6+ WORKDIR /var/www/html
47
58# Install packages and remove default server definition
6- RUN apk --no-cache add \
9+ RUN apk add --no-cache --update \
710 curl \
811 nginx \
912 php8 \
@@ -22,8 +25,7 @@ RUN apk --no-cache add \
2225 php8-session \
2326 php8-xml \
2427 php8-xmlreader \
25- php8-zlib \
26- supervisor
28+ php8-zlib
2729
2830# Create symlink so programs depending on `php` still function
2931RUN ln -s /usr/bin/php8 /usr/bin/php
@@ -35,23 +37,17 @@ COPY config/nginx.conf /etc/nginx/nginx.conf
3537COPY config/fpm-pool.conf /etc/php8/php-fpm.d/www.conf
3638COPY config/php.ini /etc/php8/conf.d/custom.ini
3739
38- # Configure supervisord
40+ # Install a golang port of supervisord and Configure
41+ COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/bin/supervisord
3942COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
4043
41- # Setup document root
42- RUN mkdir -p /var/www/html
43-
4444# Make sure files/folders needed by the processes are accessable when they run under the nobody user
45- RUN chown -R nobody.nobody /var/www/html && \
46- chown -R nobody.nobody /run && \
47- chown -R nobody.nobody /var/lib/nginx && \
48- chown -R nobody.nobody /var/log/nginx
45+ RUN chown -R nobody.nobody /var/www/html /run /var/lib/nginx /var/log/nginx
4946
5047# Switch to use a non-root user from here on
5148USER nobody
5249
5350# Add application
54- WORKDIR /var/www/html
5551COPY --chown=nobody src/ /var/www/html/
5652
5753# Expose the port nginx is reachable on
0 commit comments