55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
# Secrets come from .env (auto-loaded by Compose) — never hard-code credentials here.
|
|
# Copy .env.example to .env and fill in values before running.
|
|
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-game}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB:-star_wars_grid}
|
|
volumes:
|
|
- ./data/postgres:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-game} -d ${POSTGRES_DB:-star_wars_grid}"]
|
|
interval: 3s
|
|
timeout: 5s
|
|
retries: 15
|
|
start_period: 5s
|
|
|
|
users_db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USERS_USER:-users}
|
|
POSTGRES_PASSWORD: ${POSTGRES_USERS_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_USERS_DB:-star_wars_users}
|
|
volumes:
|
|
- ./data/postgres_users:/var/lib/postgresql/data
|
|
ports:
|
|
- "5433:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USERS_USER:-users} -d ${POSTGRES_USERS_DB:-star_wars_users}"]
|
|
interval: 3s
|
|
timeout: 5s
|
|
retries: 15
|
|
start_period: 5s
|
|
|
|
app:
|
|
build: .
|
|
ports:
|
|
- "${PORT:-8080}:8080"
|
|
environment:
|
|
DATABASE_URL: "postgres://${POSTGRES_USER:-game}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-star_wars_grid}"
|
|
USERS_DATABASE_URL: "postgres://${POSTGRES_USERS_USER:-users}:${POSTGRES_USERS_PASSWORD}@users_db:5432/${POSTGRES_USERS_DB:-star_wars_users}"
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
PORT: "${PORT:-8080}"
|
|
CONFIG_FILE_PATH: /app/config/game.settings.json
|
|
CORS_ORIGIN: ${CORS_ORIGIN:-*}
|
|
volumes:
|
|
- ./config:/app/config
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
users_db:
|
|
condition: service_healthy |