feat: dockerfile
This commit is contained in:
+16
-10
@@ -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
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -17,7 +29,6 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|||||||
|
|
||||||
COPY composer.json composer.lock ./
|
COPY composer.json composer.lock ./
|
||||||
|
|
||||||
|
|
||||||
RUN composer install \
|
RUN composer install \
|
||||||
--no-dev \
|
--no-dev \
|
||||||
--no-interaction \
|
--no-interaction \
|
||||||
@@ -28,17 +39,13 @@ RUN composer install \
|
|||||||
|
|
||||||
COPY . .
|
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 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 config:cache
|
||||||
RUN php artisan route:cache
|
RUN php artisan route:cache
|
||||||
RUN php artisan view:cache
|
RUN php artisan view:cache
|
||||||
@@ -49,5 +56,4 @@ RUN chown -R www-data:www-data storage bootstrap/cache
|
|||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
||||||
CMD ["frankenphp", "php-server", "--listen", "0.0.0.0:8000"]
|
CMD ["frankenphp", "php-server", "--listen", "0.0.0.0:8000"]
|
||||||
|
|||||||
Reference in New Issue
Block a user