60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:17.6-bookworm
|
|
environment:
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Generate .env as described in REPORT.md}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "messenger", "-d", "messenger"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 15
|
|
|
|
redis:
|
|
image: redis:7.4.6-bookworm
|
|
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "always", "--save", ""]
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 15
|
|
|
|
migrate:
|
|
image: labkos-two-api:lab2
|
|
build: .
|
|
environment:
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Generate .env as described in REPORT.md}
|
|
command: ["python", "-m", "messenger.migrate"]
|
|
healthcheck:
|
|
disable: true
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
api:
|
|
image: labkos-two-api:lab2
|
|
build: .
|
|
environment:
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Generate .env as described in REPORT.md}
|
|
CURSOR_SECRET: ${CURSOR_SECRET:?Generate .env as described in REPORT.md}
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
ports:
|
|
- "127.0.0.1:${APP_PORT:-8080}:8080"
|
|
dns_opt:
|
|
- timeout:1
|
|
- attempts:1
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|