Multi-stage Dockerfile (node:20 builder + php:8.2-fpm-alpine runtime), nginx serving frontend SPA + PHP-FPM backend at /lux-studio/, supervisord managing both processes. docker-compose.prod.yml on port 8085, .env.optical mounted read-only, uploads in a named volume. Apache include at deploy/apache-lux-studio.conf proxies /lux-studio/ → :8085. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
1.4 KiB
Docker
38 lines
1.4 KiB
Docker
# ── Stage 1: build frontend ───────────────────────────────────────────────────
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /build
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci --quiet
|
|
COPY frontend/ ./
|
|
COPY frontend/.env.optical .env
|
|
RUN npm run build
|
|
|
|
# ── Stage 2: runtime (nginx + php-fpm) ────────────────────────────────────────
|
|
FROM php:8.2-fpm-alpine
|
|
RUN apk add --no-cache nginx supervisor
|
|
|
|
# Composer
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
# Backend PHP deps (separate layer so code changes don't bust cache)
|
|
WORKDIR /var/www/html/lux-studio/api
|
|
COPY backend/composer.json ./
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
|
|
|
# Backend PHP files
|
|
COPY backend/*.php ./
|
|
|
|
# Built frontend
|
|
COPY --from=builder /build/dist /var/www/html/lux-studio
|
|
|
|
# nginx + supervisord config
|
|
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
|
COPY docker/supervisord.conf /etc/supervisord.conf
|
|
|
|
# uploads dir (overridden by named volume at runtime)
|
|
RUN mkdir -p /var/www/html/lux-studio/api/uploads/sessions \
|
|
&& chown -R www-data:www-data /var/www/html/lux-studio \
|
|
&& chmod -R 777 /var/www/html/lux-studio/api/uploads
|
|
|
|
EXPOSE 80
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|