41 lines
1.0 KiB
Docker
41 lines
1.0 KiB
Docker
# --- Étape de Build ---
|
|
FROM composer:2.7 AS build
|
|
WORKDIR /var/www/html
|
|
COPY . .
|
|
RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
|
|
|
|
# --- Étape Finale (Production) ---
|
|
FROM dunglas/frankenphp:1.3-php8.4-alpine
|
|
|
|
# Installation des dépendances système pour Postgres et GD
|
|
RUN apk add --no-cache \
|
|
libpq-dev \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev \
|
|
freetype-dev \
|
|
icu-dev
|
|
|
|
# Installation des extensions PHP
|
|
RUN install-php-extensions \
|
|
intl \
|
|
pdo_pgsql \
|
|
gd \
|
|
zip \
|
|
opcache
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
# Copie des fichiers depuis le build
|
|
COPY --from=build /var/www/html /var/www/html
|
|
|
|
# Variables d'environnement pour Laravel
|
|
ENV APP_ENV=production
|
|
ENV APP_RUNTIME=Laravel\FrankenPHP\Runtime
|
|
ENV MAX_REQUESTS=500
|
|
|
|
# Droits d'accès pour le stockage
|
|
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
|
|
|
|
# Commande de démarrage
|
|
CMD ["sh", "-c", "php artisan migrate --force && php artisan storage:link && frankenphp run --config /etc/caddy/Caddyfile"]
|