name: warg-server
services:
api:
environment:
WARG_DATA_STORE: postgres
WARG_DATABASE_URL: "postgres://warg:${POSTGRES_PASSWORD}@postgres:5432/warg"
depends_on:
migration:
condition: service_completed_successfully
migration:
build:
context: .
target: migration
environment:
DATABASE_URL: "postgres://warg:${POSTGRES_PASSWORD}@postgres:5432/warg"
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: warg
POSTGRES_USER: warg
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "warg", "-U", "warg" ]
start_period: 5s
start_interval: 10s
interval: 10s
timeout: 5s
retries: 5
secrets:
- postgres_password
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
secrets:
postgres_password:
environment: "POSTGRES_PASSWORD"
volumes:
postgres-data: