63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
services:
|
|
database:
|
|
image: postgres:16
|
|
hostname: database
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DATABASE:-sarlink}
|
|
POSTGRES_USER: ${POSTGRES_USER:-sarlink}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-sarlink}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
backend:
|
|
build:
|
|
context: ../../
|
|
dockerfile: .build/prod/api.Dockerfile
|
|
hostname: backend
|
|
image: git.shihaam.dev/sarlink/sarlinkportal/backend
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ../../backend/.env
|
|
volumes:
|
|
- media:/app/media
|
|
depends_on:
|
|
database:
|
|
condition: service_healthy
|
|
|
|
# Background tasks: same image, procrastinate worker instead of gunicorn.
|
|
worker:
|
|
image: git.shihaam.dev/sarlink/sarlinkportal/backend
|
|
restart: unless-stopped
|
|
command: python manage.py procrastinate worker
|
|
env_file:
|
|
- ../../backend/.env
|
|
volumes:
|
|
- media:/app/media
|
|
depends_on:
|
|
- backend
|
|
|
|
# The only published container: static SPA + reverse proxy to the API.
|
|
web:
|
|
build:
|
|
context: ../../
|
|
dockerfile: .build/prod/web.Dockerfile
|
|
hostname: web
|
|
image: git.shihaam.dev/sarlink/sarlinkportal/web
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
- media:/app/media:ro
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
pgdata:
|
|
media:
|