forked from mtusi2026/mtusi2026lab2
37 lines
1.0 KiB
YAML
37 lines
1.0 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16.4
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
api:
|
|
build: .
|
|
environment:
|
|
APP_HOST: ${APP_HOST:-0.0.0.0}
|
|
APP_PORT: ${APP_PORT:-8080}
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready')"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
volumes:
|
|
postgres-data:
|