Add multi-stage build for front-end assets in Dockerfile
All checks were successful
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m5s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m2s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m10s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m2s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m9s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 35s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 20m41s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m3s

This commit is contained in:
2026-01-02 16:20:29 -05:00
parent 264d6361c3
commit 25c44bf595

View File

@@ -11,6 +11,17 @@ ADD composer.json composer.lock ./
RUN composer install --optimize-autoloader --ignore-platform-reqs --no-dev RUN composer install --optimize-autoloader --ignore-platform-reqs --no-dev
FROM node:22-alpine AS node
# Set the working directory to /app
WORKDIR /app/front-end
# Copy package.json and package-lock.json to the working directory
COPY front-end/ .
# Install Node.js dependencies
RUN npm install && npm run build
# Use the official PHP CLI image with Alpine Linux for the second stage # Use the official PHP CLI image with Alpine Linux for the second stage
FROM siteworxpro/php:8.5.1-cli-alpine AS php FROM siteworxpro/php:8.5.1-cli-alpine AS php
@@ -43,6 +54,9 @@ COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr
# Copy the installed PHP dependencies from the library stage # Copy the installed PHP dependencies from the library stage
COPY --from=library /app/vendor /app/vendor COPY --from=library /app/vendor /app/vendor
# Copy the built front-end assets from the node stage
COPY --from=node /app/public /app/public
# Copy the RoadRunner configuration file and source # Copy the RoadRunner configuration file and source
ADD src src/ ADD src src/
ADD generated generated/ ADD generated generated/