CityGame/docker-compose.yml
Camille 7a9383e87f feat: bootstrap fullstack NX monorepo (Spring Boot + React)
- Add Spring Boot 3.4 backend with health API, CORS, and dev/prod profiles
- Add React 18 + Vite frontend with typed health client
- Configure NX workspace, pnpm, and Docker Compose stacks
- Document stack, commands, and layout in README
- Add .gitignore for Node, Java, Docker, and IDE artifacts
2026-05-29 23:42:03 +02:00

75 lines
2.4 KiB
YAML

# ──────────────────────────────────────────────────────
# PRODUCTION — docker compose up
# Requires: npm run docker:build (or make docker:build)
# ──────────────────────────────────────────────────────
name: citygame
services:
# ── Database ──────────────────────────────────
db:
image: postgres:16-alpine
container_name: citygame-db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-citygame}
POSTGRES_USER: ${DB_USERNAME:-citygame}
POSTGRES_PASSWORD: ${DB_PASSWORD:-citygame}
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- citygame-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-citygame} -d ${DB_NAME:-citygame}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# ── Backend (Spring Boot) ─────────────────────
backend:
image: citygame-backend:latest
container_name: citygame-backend
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: prod
DB_URL: jdbc:postgresql://db:5432/${DB_NAME:-citygame}
DB_USERNAME: ${DB_USERNAME:-citygame}
DB_PASSWORD: ${DB_PASSWORD:-citygame}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost}
JAVA_TOOL_OPTIONS: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
ports:
- "${BACKEND_PORT:-8080}:8080"
networks:
- citygame-net
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ── Frontend (nginx) ──────────────────────────
frontend:
image: citygame-frontend:latest
container_name: citygame-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- "${FRONTEND_PORT:-80}:80"
networks:
- citygame-net
volumes:
pgdata:
driver: local
networks:
citygame-net:
driver: bridge