Files
mtusi2026lab2/docker-compose.yml
T

46 lines
951 B
YAML

services:
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: messenger
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
volumes:
- pgdata:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d messenger"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: valkey/valkey:7-alpine
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
api:
build: .
ports:
- "8080:8080"
environment:
- DB_HOST=db
- DB_USER=postgres
- DB_PASSWORD=secret
- DB_NAME=messenger
- REDIS_HOST=redis
- SESSION_TTL_SECONDS=3600
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
pgdata:
redisdata: