-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.php
More file actions
67 lines (51 loc) · 2.04 KB
/
Dockerfile.php
File metadata and controls
67 lines (51 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
############################################
# Base Image
############################################
# Learn more about the Server Side Up PHP Docker Images at:
# https://serversideup.net/open-source/docker-php/
FROM serversideup/php:8.5-fpm-nginx AS base
## Uncomment if you need to install additional PHP extensions
USER root
RUN install-php-extensions imagick
############################################
# 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
# Trust the self-signed certificate
COPY .infrastructure/conf/traefik/dev/certificates/local-ca.pem /usr/local/share/ca-certificates/local-ca.crt
RUN update-ca-certificates
# 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
# Drop privileges back to www-data
USER www-data
############################################
# CI image
############################################
FROM base AS ci
# Sometimes CI images need to run as root
USER root
############################################
# Production Image
############################################
FROM base AS deploy
# Install Node.js for Inertia SSR
USER root
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --chown=www-data:www-data . /var/www/html
# Copy s6-overlay configuration for Inertia SSR service
COPY --chown=root:root .infrastructure/s6-overlay /etc/s6-overlay
# Create the SQLite directory and set the owner to www-data (remove this if you're not using SQLite)
RUN mkdir -p /var/www/html/.infrastructure/volume_data/sqlite/ && \
chown -R www-data:www-data /var/www/html/.infrastructure/volume_data/sqlite/
USER www-data