Files
mtusi2026lab3/compose.yaml

59 lines
1.2 KiB
YAML

services:
db:
image: postgres:16.3-bookworm
environment:
POSTGRES_USER: messenger
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: messenger
volumes:
- pgdata:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d/
healthcheck:
test: ["CMD-SHELL", "pg_isready -U messenger"]
interval: 5s
retries: 5
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
redis:
image: redis:7.2.5-bookworm
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
api:
build: .
environment:
DATABASE_URL: postgresql://messenger:${POSTGRES_PASSWORD}@db:5432/messenger
REDIS_URL: redis://redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
nginx:
image: nginx:1.25.5-alpine
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api
volumes:
pgdata: