build(docker): warm prod cache at build time and add prod compose file
- Run cache:warmup in the build stage so containers start with a pre-built Symfony kernel and DI container - Scope the cache volume to var/cache/prod/pools where Symfony writes pool data, preserving the warmed kernel across container restarts - Add docker-compose.prod.yml for deploying the registry image without the dev override being picked up automatically - Expand .dockerignore to exclude vendor/, tests/, docs, compose files, and env files from the build context Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -21,7 +21,9 @@ RUN composer install \
|
||||
# ── build stage (generate optimised classmap with source present) ──────────────
|
||||
FROM deps AS build
|
||||
COPY . .
|
||||
RUN composer dump-autoload --optimize --no-dev --no-interaction
|
||||
RUN composer dump-autoload --optimize --no-dev --no-interaction && \
|
||||
mkdir -p var/cache var/log && \
|
||||
APP_ENV=prod APP_SECRET=placeholder php bin/console cache:warmup --no-debug
|
||||
|
||||
# ── dev stage (all deps + Xdebug, source is mounted at runtime) ───────────────
|
||||
FROM base AS dev
|
||||
@@ -44,11 +46,11 @@ FROM base AS final
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
|
||||
COPY --from=build /app/vendor /app/vendor
|
||||
COPY --from=build /app/var/cache/prod /app/var/cache/prod
|
||||
COPY . .
|
||||
COPY docker/frankenphp/Caddyfile /etc/caddy/Caddyfile
|
||||
|
||||
RUN mkdir -p var/cache var/log \
|
||||
&& chown -R app:app /app
|
||||
RUN mkdir -p var/cache/prod/pools var/log && chown -R app:app /app
|
||||
|
||||
USER app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user