-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
259 lines (229 loc) · 8.93 KB
/
Copy pathDockerfile.dev
File metadata and controls
259 lines (229 loc) · 8.93 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# =============================================================================
# ERNIE Development Dockerfile
# =============================================================================
# Multi-stage build for local development with hot-reload support
# Usage: docker-compose -f docker-compose.dev.yml up --build
# =============================================================================
FROM mysql:8.4.11@sha256:b3b90af2a6552ae30c266fdb7d5dd55f3afb72404bb78d37fe8a23eb857fd3fb AS legacy-mysql-dump-client
# -----------------------------------------------------------------------------
# Stage: PHP-FPM Application (Development)
# -----------------------------------------------------------------------------
FROM php:8.5.10-fpm-trixie@sha256:70076c1cae0cd0ba6761832417e3a1df3e5560f0544eb0fe40357373e54420fe AS app
WORKDIR /var/www/html
ARG PHP_REDIS_VERSION=6.3.0
ARG XDEBUG_VERSION=3.5.3
ARG NPM_VERSION=12.0.2
ARG NODE_CHECKSUM_ARM64=23c1b4d19e2f12a7d06fe8aa3d6e0e4923cf77a47e13c5ccdf32fadaa33960f2
ARG NODE_CHECKSUM_X64=3e301118d7df53d563b7e96c1617545f26e2f76f9724be668d6cab65c15dda5d
# Copy the exact Node.js version from the repository's single source of truth.
COPY .node-version /tmp/.node-version
# Install system dependencies and the verified Node.js release in one RUN step to keep the build
# setup straightforward.
# LEGACY_DATABASE_DUMP_SUPPORT:
# Required for the admin-only /database dump page while legacy MySQL 5.6/5.7 exports exist.
# Remove this package when legacy database exports are retired.
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libzip-dev \
libsodium-dev \
libxslt1-dev \
libicu-dev \
python3 \
make \
g++ \
netcat-traditional \
default-mysql-client \
ca-certificates \
libssl3t64 \
openssl \
openssl-provider-legacy \
gnupg \
# Playwright browser runtime dependencies for Pest Browser smoke tests.
at-spi2-common \
fontconfig \
fontconfig-config \
fonts-freefont-ttf \
fonts-ipafont-gothic \
fonts-liberation \
fonts-noto-color-emoji \
fonts-tlwg-loma-otf \
fonts-unifont \
fonts-wqy-zenhei \
libasound2-data \
libasound2t64 \
libatk-bridge2.0-0t64 \
libatk1.0-0t64 \
libatspi2.0-0t64 \
libavahi-client3 \
libavahi-common-data \
libavahi-common3 \
libcairo2 \
libcups2t64 \
libdatrie1 \
libdbus-1-3 \
libdrm-amdgpu1 \
libdrm-common \
libdrm-intel1 \
libdrm2 \
libelf1t64 \
libfontconfig1 \
libfontenc1 \
libfreetype6 \
libfribidi0 \
libgbm1 \
libgl1 \
libgl1-mesa-dri \
libglib2.0-0t64 \
libglvnd0 \
libglx-mesa0 \
libglx0 \
libgraphite2-3 \
libharfbuzz0b \
libice6 \
libllvm19 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpciaccess0 \
libpixman-1-0 \
libsensors-config \
libsensors5 \
libsm6 \
libthai-data \
libthai0 \
libunwind8 \
libvulkan1 \
libwayland-server0 \
libx11-xcb1 \
libxaw7 \
libxcb-dri3-0 \
libxcb-glx0 \
libxcb-present0 \
libxcb-randr0 \
libxcb-render0 \
libxcb-shm0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxfixes3 \
libxfont2 \
libxi6 \
libxkbcommon0 \
libxkbfile1 \
libxmu6 \
libxpm4 \
libxrandr2 \
libxrender1 \
libxshmfence1 \
libxt6t64 \
libxxf86vm1 \
libz3-4 \
mesa-libgallium \
x11-common \
x11-xkb-utils \
xfonts-encodings \
xfonts-scalable \
xfonts-utils \
xkb-data \
xserver-common \
xvfb \
xz-utils \
# Install the exact stable Node.js release and verify it for supported architectures.
&& NODE_VERSION="$(tr -d '\r\n' < /tmp/.node-version)" \
&& NODE_VERSION="${NODE_VERSION#v}" \
&& case "$(dpkg --print-architecture)" in \
amd64) NODE_ARCH='x64'; NODE_CHECKSUM="${NODE_CHECKSUM_X64}" ;; \
arm64) NODE_ARCH='arm64'; NODE_CHECKSUM="${NODE_CHECKSUM_ARM64}" ;; \
*) echo "Unsupported Node.js build architecture: $(dpkg --print-architecture)" >&2; exit 1 ;; \
esac \
&& NODE_ARCHIVE="node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" \
&& curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/${NODE_ARCHIVE}" -o "/tmp/${NODE_ARCHIVE}" \
&& echo "${NODE_CHECKSUM} /tmp/${NODE_ARCHIVE}" | sha256sum -c - \
&& tar -xJf "/tmp/${NODE_ARCHIVE}" -C /usr/local --strip-components=1 --no-same-owner \
&& rm -f "/tmp/${NODE_ARCHIVE}" \
&& npm install --global "npm@${NPM_VERSION}" \
&& node --version \
&& npm --version \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# MariaDB 11.x's dump client is incompatible with the legacy MySQL 5.6 IGSN
# server. Keep this separate Oracle client only while that export is required.
COPY --from=legacy-mysql-dump-client /usr/bin/mysqldump /usr/local/bin/mysql-legacy-mysqldump
RUN /usr/local/bin/mysql-legacy-mysqldump --version
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip sodium xsl intl sockets
# Install Redis extension from the official phpredis source tag.
RUN set -eux; \
curl -fsSL "https://github.com/phpredis/phpredis/archive/refs/tags/${PHP_REDIS_VERSION}.tar.gz" -o /tmp/phpredis.tar.gz; \
mkdir -p /usr/src/php/ext/redis; \
tar -xzf /tmp/phpredis.tar.gz -C /usr/src/php/ext/redis --strip-components=1; \
docker-php-ext-install redis; \
rm -rf /tmp/phpredis.tar.gz /usr/src/php/ext/redis
# Install a reproducible Xdebug release for debugging and coverage
# (optional at runtime, disabled by default).
RUN pecl install "xdebug-${XDEBUG_VERSION}" && docker-php-ext-enable xdebug
# Configure Xdebug (disabled by default - enable via env vars)
RUN echo "xdebug.mode=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.start_with_request=trigger" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Install Composer
COPY --from=composer:2.10.3@sha256:4d045ea9f71d5d111a95e608400da61d187e487adf9eaf2dfe068998a8d4f584 /usr/bin/composer /usr/bin/composer
# Create symlink for php in /bin so it's available in all shells
RUN ln -s /usr/local/bin/php /bin/php
# Copy development entrypoint
COPY docker/dev-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/dev-entrypoint.sh
# PHP-FPM pool configuration for optimized worker management
COPY docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf
# Copy SSL certificates for external database connections
COPY docker/certs/sumariopmd-ca.crt /usr/local/share/ca-certificates/sumariopmd-ca.crt
RUN update-ca-certificates
# Set permissions for development
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
EXPOSE 9000
ENTRYPOINT ["dev-entrypoint.sh"]
CMD ["php-fpm"]
# -----------------------------------------------------------------------------
# Stage: Nginx Webserver (Development)
# -----------------------------------------------------------------------------
FROM nginx:1.31.4-alpine@sha256:db35bfc6b2951e7f8a72db5db120288c127ffaeeb4a6d4b95a26fead017d5913 AS nginx
WORKDIR /var/www/html
# Copy nginx configuration (dev config is mounted as volume)
# The dev.conf will be mounted via docker-compose
# Copy nginx snippets for shared configuration
COPY docker/nginx/snippets/ /etc/nginx/snippets/
EXPOSE 80
# -----------------------------------------------------------------------------
# Stage: Vite Development Server (Alternative - currently unused)
# -----------------------------------------------------------------------------
# Note: docker-compose.dev.yml uses the 'app' stage for the vite container
# because the Wayfinder plugin requires php artisan access. This stage is
# kept for potential future use with a standalone Vite setup.
# -----------------------------------------------------------------------------
FROM app AS vite
WORKDIR /var/www/html
# Native module build prerequisites are inherited from the app stage.
# Create startup script that ensures dependencies are installed
RUN echo '#!/bin/sh' > /usr/local/bin/vite-entrypoint.sh && \
echo 'set -e' >> /usr/local/bin/vite-entrypoint.sh && \
echo 'cd /var/www/html' >> /usr/local/bin/vite-entrypoint.sh && \
echo 'if [ ! -d "node_modules" ] || [ ! "$(ls -A node_modules 2>/dev/null)" ]; then' >> /usr/local/bin/vite-entrypoint.sh && \
echo ' echo "Installing npm dependencies..."' >> /usr/local/bin/vite-entrypoint.sh && \
echo ' npm install' >> /usr/local/bin/vite-entrypoint.sh && \
echo 'fi' >> /usr/local/bin/vite-entrypoint.sh && \
echo 'exec "$@"' >> /usr/local/bin/vite-entrypoint.sh && \
chmod +x /usr/local/bin/vite-entrypoint.sh
EXPOSE 5173
ENTRYPOINT ["/usr/local/bin/vite-entrypoint.sh"]
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]