36 lines
1.3 KiB
Docker
36 lines
1.3 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 files + deps
|
|
WORKDIR /var/www/html/lux-studio/api
|
|
COPY backend/*.php ./
|
|
COPY backend/composer.json ./
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-security-blocking
|
|
|
|
# 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"]
|