fix: move cache:warmup to runtime entrypoint, fix POSTGRES_PASSWORD default
cache:warmup at build time fails because .env.local is not available in the image (gitignored). Moved to entrypoint.sh which runs after volume mounts. Also added default value for POSTGRES_PASSWORD in docker-compose.yml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,14 +25,20 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copie des dépendances en premier (cache Docker)
|
||||
# Dépendances en premier (cache Docker layer)
|
||||
COPY backend/composer.json backend/composer.lock ./
|
||||
RUN composer install --no-dev --optimize-autoloader --no-scripts
|
||||
|
||||
# Copie du reste
|
||||
# Code source
|
||||
COPY backend/ .
|
||||
|
||||
RUN composer dump-autoload --optimize \
|
||||
&& php bin/console cache:warmup --env=prod
|
||||
# Autoload uniquement — pas de cache:warmup ici (besoin de .env.local au runtime)
|
||||
RUN composer dump-autoload --optimize
|
||||
|
||||
COPY docker/php/Caddyfile /etc/caddy/Caddyfile
|
||||
|
||||
# Entrypoint : warmup au démarrage du conteneur, quand .env.local est monté
|
||||
COPY docker/php/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user