forked from mtusi2026/mtusi2026lab2
27 lines
774 B
YAML
27 lines
774 B
YAML
services:
|
|
postgres:
|
|
image: postgres:16.8-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-messenger}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger_local_only}
|
|
POSTGRES_DB: ${POSTGRES_DB:-messenger}
|
|
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:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-messenger}:${POSTGRES_PASSWORD:-messenger_local_only}@postgres:5432/${POSTGRES_DB:-messenger}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
ports:
|
|
- "8080:8080"
|
|
restart: unless-stopped
|
|
volumes:
|
|
postgres_data:
|