chore: consolidate app compose dev and prod

This commit is contained in:
kcar 2026-05-27 22:55:00 +01:00
parent 77282893f3
commit e68eef8865
5 changed files with 14437 additions and 8 deletions

4
.gitignore vendored
View File

@ -43,3 +43,7 @@ docker-compose.override.yml
.cache/
.tmp/
*.tmp
# Local environment variants
.env.dev
.env.prod

View File

@ -1,12 +1,17 @@
FROM node:20 AS builder
WORKDIR /app
COPY package*.json ./
# TODO: Remove this or review embedded variables
COPY .env .env
# First generate package-lock.json if it doesn't exist, then do clean install
RUN if [ ! -f package-lock.json ]; then npm install --package-lock-only; fi && npm ci
COPY . .
# Vite bakes VITE_* values at build time, so compose must choose the env file
# during image build, not only at container runtime.
ARG ENV_FILE=.env
COPY ${ENV_FILE} .env
# Run build with production mode
RUN npm run build -- --mode production

21
docker-compose.dev.yml Normal file
View File

@ -0,0 +1,21 @@
services:
frontend-dev:
container_name: cc-app-dev
image: cc-app-dev:latest
build:
context: .
dockerfile: Dockerfile
args:
ENV_FILE: .env.dev
env_file:
- .env.dev
ports:
- "13000:3000"
networks:
- kevlarai-network
restart: unless-stopped
networks:
kevlarai-network:
external: true
name: kevlarai-network

View File

@ -1,19 +1,21 @@
services:
classroom-copilot:
container_name: classroom-copilot
frontend:
container_name: cc-prod
image: cc-app-prod:latest
build:
context: .
dockerfile: Dockerfile
args:
ENV_FILE: .env
env_file:
- .env
ports:
- 3000:3000
volumes:
- ./:/app
- "3000:3000"
networks:
- kevlarai-network
restart: unless-stopped
networks:
kevlarai-network:
external: true
name: kevlarai-network
driver: bridge

14397
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff