Files
got-gaming/docker-compose.yml

70 lines
2.2 KiB
YAML

version: "3.8"
services:
got-postgres:
image: postgres:15-alpine
container_name: got-mc-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-gotgaming}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-this-in-production}
POSTGRES_DB: ${POSTGRES_DB:-gotgaming}
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
volumes:
- ${POSTGRES_DATA_PATH:-./data/postgres}:/var/lib/postgresql/data
ports:
- "5433:5432"
restart: unless-stopped
command: postgres -c max_connections=100 -c shared_buffers=256MB -c effective_cache_size=1GB
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-gotgaming} -d ${POSTGRES_DB:-gotgaming}",
]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
got-app:
build:
context: .
dockerfile: Dockerfile
container_name: got-mc-app
ports:
- "3040:3000"
environment:
- NODE_ENV=production
- POSTGRES_USER=${POSTGRES_USER:-gotgaming}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-change-this-in-production}
- POSTGRES_DB=${POSTGRES_DB:-gotgaming}
- DATABASE_URL=postgresql://${POSTGRES_USER:-gotgaming}:${POSTGRES_PASSWORD:-change-this-in-production}@got-postgres:5432/${POSTGRES_DB:-gotgaming}?schema=public
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-change-this-secret-in-production}
volumes:
# Persist uploaded images (avatars and backgrounds)
- ${UPLOADS_PATH:-./public/uploads}:/app/public/uploads
# Migrations: décommenter uniquement en développement local pour modifier les migrations sans rebuild
# En production, les migrations sont incluses dans l'image Docker
# - ./prisma/migrations:/app/prisma/migrations
depends_on:
got-postgres:
condition: service_healthy
restart: unless-stopped
labels:
- "com.centurylinklabs.watchtower.enable=false"
healthcheck:
test:
[
"CMD",
"wget",
"--quiet",
"--tries=1",
"--spider",
"http://localhost:3000/api/health || exit 1",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s