Skip to content

Commit 934ac40

Browse files
authored
Update templates to be compatible with latest serversideup/php beta (#77)
1 parent a4ab867 commit 934ac40

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

templates/laravel/Dockerfile

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
1+
############################################
2+
# Base Image
3+
############################################
4+
15
# Learn more about the Server Side Up PHP Docker Images at:
26
# https://serversideup.net/open-source/docker-php/
3-
47
FROM serversideup/php:beta-8.3-fpm-nginx as base
58

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+
############################################
616
FROM base as development
717

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.
1021
ARG USER_ID
1122
ARG GROUP_ID
12-
RUN docker-php-serversideup-set-id www-data ${USER_ID} ${GROUP_ID}
1323

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+
############################################
1444
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

templates/laravel/docker-compose.dev.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32
traefik:
43
networks:
@@ -33,7 +32,7 @@ services:
3332
- "traefik.http.routers.laravel.rule=HostRegexp(`laravel.dev.test`)"
3433
- "traefik.http.routers.laravel.entrypoints=websecure"
3534
- "traefik.http.routers.laravel.tls=true"
36-
- "traefik.http.services.laravel.loadbalancer.server.port=80"
35+
- "traefik.http.services.laravel.loadbalancer.server.port=8080"
3736
- "traefik.http.services.laravel.loadbalancer.server.scheme=http"
3837

3938
node:

templates/laravel/docker-compose.prod.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32

43
traefik:
@@ -86,7 +85,7 @@ services:
8685
- "traefik.http.routers.my-php-app.entrypoints=websecure"
8786
- "traefik.http.routers.my-php-app.tls=true"
8887
- "traefik.http.routers.my-php-app.tls.certresolver=letsencryptresolver"
89-
- "traefik.http.services.my-php-app.loadbalancer.server.port=80"
88+
- "traefik.http.services.my-php-app.loadbalancer.server.port=8080"
9089
- "traefik.http.services.my-php-app.loadbalancer.server.scheme=http"
9190
# Health check
9291
- "traefik.http.services.my-php-app.loadbalancer.healthcheck.path=/ping"

templates/laravel/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32

43
traefik:

0 commit comments

Comments
 (0)