From c192befc6b92c0e1ced508bb83c9c923c415c02a Mon Sep 17 00:00:00 2001 From: Leon Morival Date: Fri, 10 Jul 2026 16:24:36 +0200 Subject: [PATCH] feat: dockerfile --- Dockerfile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index c303c96..dfb00cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,17 @@ -FROM dunglas/frankenphp:php8.4-alpine +# ── Stage 1 : build des assets frontend ───────────────────────────────────── +FROM node:22-alpine AS frontend +WORKDIR /app + +COPY package.json package-lock.json* ./ +RUN npm ci --ignore-scripts + +COPY . . +RUN npm run build + + +# ── Stage 2 : image de production PHP/FrankenPHP ───────────────────────────── +FROM dunglas/frankenphp:php8.4-alpine WORKDIR /app @@ -17,7 +29,6 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer COPY composer.json composer.lock ./ - RUN composer install \ --no-dev \ --no-interaction \ @@ -28,17 +39,13 @@ RUN composer install \ COPY . . +# Écrase public/build avec les assets compilés par le stage frontend +COPY --from=frontend /app/public/build ./public/build + RUN composer dump-autoload --optimize -RUN npm install -RUN npm run build - - -RUN php artisan octane:install --server=frankenphp || true - - RUN php artisan config:cache RUN php artisan route:cache RUN php artisan view:cache @@ -49,5 +56,4 @@ RUN chown -R www-data:www-data storage bootstrap/cache EXPOSE 8000 - CMD ["frankenphp", "php-server", "--listen", "0.0.0.0:8000"]