Fix deploy
All checks were successful
Deploy App / build-and-deploy (push) Successful in 2m12s

This commit is contained in:
2025-08-31 02:02:30 +02:00
parent 03e3bda0ce
commit a54308f710
3 changed files with 38 additions and 18 deletions

View File

@@ -1,9 +1,11 @@
FROM php:8.4-fpm
# ----------------------------
# Stage 1: PHP + Composer
# ----------------------------
FROM php:8.4-fpm AS php-base
# Set working dir
WORKDIR /var/www/html
# Install system deps
# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
git curl libpng-dev libonig-dev libxml2-dev zip unzip \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
@@ -14,30 +16,47 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Copy app code
COPY . .
# Install PHP deps (no dev)
# Install PHP dependencies (no dev)
RUN composer install --no-dev --optimize-autoloader --no-interaction
# Node build (optional if you need assets)
# ----------------------------
# Stage 2: Node build
# ----------------------------
FROM node:20 AS frontend
WORKDIR /app
# Copy Node dependencies and install
# Copy only package files and install Node dependencies
COPY package*.json ./
RUN npm ci
# Copy app code
# Copy the rest of the app code
COPY . .
# Copy vendor from composer stage
COPY --from=0 /var/www/html/vendor ./vendor
# Copy vendor from PHP stage (needed if assets reference PHP files)
COPY --from=php-base /var/www/html/vendor ./vendor
# Build assets
RUN npm run build
# Copy built assets into PHP image
FROM php:8.4-fpm
# ----------------------------
# Stage 3: Final production image
# ----------------------------
FROM php:8.4-fpm AS final
WORKDIR /var/www/html
COPY --from=0 /var/www/html .
# Install system deps and PHP extensions in the final image
RUN apt-get update && apt-get install -y \
git curl libpng-dev libonig-dev libxml2-dev zip unzip \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Copy PHP code + vendor
COPY --from=php-base /var/www/html .
# Copy built frontend assets
COPY --from=frontend /app/public ./public
# Fix permissions for Laravel