############################################ # Base Image ############################################ # Learn more about the Server Side Up PHP Docker Images at: # https://serversideup.net/open-source/docker-php/ FROM serversideup/php-dev:523-8.3-fpm-nginx-alpine AS base ## Uncomment if you need to install additional PHP extensions # USER root # RUN install-php-extensions bcmath gd ############################################ # Development Image ############################################ FROM base AS development # We can pass USER_ID and GROUP_ID as build arguments # to ensure the www-data user has the same UID and GID # as the user running Docker. ARG USER_ID ARG GROUP_ID # Switch to root so we can set the user ID and group ID USER root # Set the user ID and group ID for www-data RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && \ docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx # Drop privileges back to www-data USER www-data ############################################ # CI image ############################################ FROM base AS ci # Sometimes CI images need to run as root # so we set the ROOT user and configure # the PHP-FPM pool to run as www-data USER root RUN echo "user = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf && \ echo "group = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf ############################################ # Production Image ############################################ FROM base AS release COPY --chown=www-data:www-data . /var/www/html ENV SSL_MODE=mixed USER www-data