All checks were successful
Build & Push Docker Image / build (push) Successful in 1m4s
Update Dockerfile, nginx, .dockerignore, makefile, CI workflow, CLAUDE.md, README, release script to use frontend/ instead of Inventory_frontend/. Remove submodule references from CI and release script. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84 lines
2.5 KiB
Docker
84 lines
2.5 KiB
Docker
# --- Stage 1: Build backend ---
|
|
FROM php:8.4-cli AS backend-build
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
|
|
unzip curl git \
|
|
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
WORKDIR /app
|
|
COPY composer.json composer.lock symfony.lock ./
|
|
RUN APP_ENV=prod APP_DEBUG=0 composer install --no-dev --no-scripts --no-interaction
|
|
|
|
COPY bin bin/
|
|
COPY config config/
|
|
COPY migrations migrations/
|
|
COPY public public/
|
|
COPY src src/
|
|
COPY templates templates/
|
|
COPY VERSION VERSION
|
|
|
|
RUN composer dump-autoload --optimize --no-dev
|
|
|
|
# --- Stage 2: Build frontend ---
|
|
FROM node:lts-alpine AS frontend-build
|
|
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
ENV CI=1 \
|
|
NUXT_TELEMETRY_DISABLED=1 \
|
|
NUXT_PUBLIC_API_BASE_URL=/api \
|
|
NUXT_PUBLIC_APP_BASE=/
|
|
RUN npm run generate
|
|
|
|
# --- Stage 3: Production image ---
|
|
FROM php:8.4-fpm AS production
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
|
|
nginx supervisor \
|
|
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# PHP production config
|
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
|
|
|
# PHP-FPM: forward worker output to stderr for docker logs
|
|
RUN echo "catch_workers_output = yes" >> /usr/local/etc/php-fpm.d/www.conf \
|
|
&& echo "decorate_workers_output = no" >> /usr/local/etc/php-fpm.d/www.conf
|
|
|
|
# Nginx: log to stdout/stderr
|
|
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
|
|
|
# Remove default nginx site
|
|
RUN rm -f /etc/nginx/sites-enabled/default
|
|
|
|
# Configs
|
|
COPY deploy/docker/supervisord.conf /etc/supervisor/conf.d/app.conf
|
|
COPY deploy/docker/nginx.conf /etc/nginx/sites-enabled/inventory.conf
|
|
|
|
# Backend from stage 1
|
|
COPY --from=backend-build /app /var/www/html
|
|
|
|
# Frontend from stage 2
|
|
COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.output/public
|
|
|
|
# Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose)
|
|
RUN echo "APP_ENV=prod" > /var/www/html/.env
|
|
|
|
# Permissions
|
|
RUN mkdir -p /var/www/html/var /var/www/html/var/uploads \
|
|
&& chown -R www-data:www-data /var/www/html/var
|
|
|
|
WORKDIR /var/www/html
|
|
EXPOSE 80
|
|
|
|
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/app.conf"]
|