1
+ # ###########################################
2
+ # Base Image
3
+ # ###########################################
4
+
1
5
# Learn more about the Server Side Up PHP Docker Images at:
2
6
# https://serversideup.net/open-source/docker-php/
3
-
4
7
FROM serversideup/php:beta-8.3-fpm-nginx as base
5
8
9
+ # # Uncomment if you need to install additional PHP extensions
10
+ # USER root
11
+ # RUN install-php-extensions bcmath gd
12
+
13
+ # ###########################################
14
+ # Development Image
15
+ # ###########################################
6
16
FROM base as development
7
17
8
- # Fix permission issues in development by setting the "www-data"
9
- # user to the same user and group that is running docker.
18
+ # We can pass USER_ID and GROUP_ID as build arguments
19
+ # to ensure the www-data user has the same UID and GID
20
+ # as the user running Docker.
10
21
ARG USER_ID
11
22
ARG GROUP_ID
12
- RUN docker-php-serversideup-set-id www-data ${USER_ID} ${GROUP_ID}
13
23
24
+ # Switch to root so we can set the user ID and group ID
25
+ RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && \
26
+ docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx
27
+ USER www-data
28
+
29
+ # ###########################################
30
+ # CI image
31
+ # ###########################################
32
+ FROM base as ci
33
+
34
+ # Sometimes CI images need to run as root
35
+ # so we set the ROOT user and configure
36
+ # the PHP-FPM pool to run as www-data
37
+ USER root
38
+ RUN echo "user = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf && \
39
+ echo "group = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf
40
+
41
+ # ###########################################
42
+ # Production Image
43
+ # ###########################################
14
44
FROM base as deploy
15
- COPY --chown=www-data:www-data . /var/www/html
45
+ COPY --chown=www-data:www-data . /var/www/html
46
+ USER www-data
0 commit comments