forked from mtusi2026/mtusi2026lab2
35 lines
878 B
YAML
35 lines
878 B
YAML
services:
|
|
db:
|
|
image: postgres:16.10-bookworm
|
|
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: 0.0.0.0
|
|
APP_PORT: 8080
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?sslmode=disable
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "./healthcheck"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
volumes:
|
|
postgres_data:
|