-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (79 loc) · 2.82 KB
/
Copy pathDockerfile
File metadata and controls
88 lines (79 loc) · 2.82 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
# syntax=docker/dockerfile:1
# ---- vendor: composer install (--no-scripts, artisan isn't bootstrappable
# with no .env yet at build time) -------------------------------------------
FROM composer:2 AS vendor
WORKDIR /app
COPY . .
# --ignore-platform-reqs: this stage only resolves/downloads packages, it never
# executes them — the runtime stage below has the real gd/redis/pdo_mysql
# extensions installed and is what actually runs the app.
RUN composer install \
--no-dev \
--no-interaction \
--no-scripts \
--optimize-autoloader \
--ignore-platform-reqs
# ---- assets: Vite build only, never ships into the runtime image -----------
FROM node:20-alpine AS assets
WORKDIR /app
# Browser-facing Reverb config. Vite inlines import.meta.env.VITE_* into the
# bundle at build time, so the runtime REVERB_* task-definition env can never
# reach it — these must arrive here as --build-arg (release-deploy.yml). ARGs
# are exposed as env to RUN, which is how Vite picks them up.
ARG VITE_REVERB_APP_KEY
ARG VITE_REVERB_HOST
ARG VITE_REVERB_PORT
ARG VITE_REVERB_SCHEME
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
# ---- runtime: PHP-FPM + nginx, no Composer/Node in the final image ----------
FROM php:8.3-fpm-alpine AS runtime
RUN apk add --no-cache \
nginx \
supervisor \
libpng \
libjpeg-turbo \
freetype \
libwebp \
libzip \
icu-libs \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libwebp-dev \
libzip-dev \
icu-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j"$(nproc)" \
pdo_mysql \
gd \
zip \
intl \
bcmath \
pcntl \
exif \
opcache \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apk del .build-deps
WORKDIR /var/www/html
COPY --from=vendor /app/vendor ./vendor
COPY --from=assets /app/public/build ./public/build
COPY . .
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
COPY docker/php.ini /usr/local/etc/php/conf.d/zz-app.ini
COPY docker/www.conf /usr/local/etc/php-fpm.d/www.conf
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh \
&& chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
EXPOSE 8080
# Overridden per ECS task definition: nginx+php-fpm for `web`,
# `php artisan reverb:start` for `reverb`, `php artisan queue:work redis
# --tries=3` for `queue-worker` — same image, three ECS services.
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf", "-n"]