Files
mtusi2026lab2/compose.yaml
T
2026-10-07 19:06:42 +03:00

63 lines
1.6 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: mtusi-postgres
environment:
POSTGRES_DB: messenger
POSTGRES_USER: messenger
POSTGRES_PASSWORD: messenger_password # для локальной разработки; в production — secrets
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U messenger"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: mtusi-redis
ports:
- "127.0.0.1:6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
api:
build:
context: .
dockerfile: Dockerfile
container_name: mtusi-api
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "127.0.0.1:8080:8080"
environment:
APP_HOST: 0.0.0.0
APP_PORT: 8080
APP_ENV: lab
DATABASE_URL: postgres://messenger:messenger_password@postgres:5432/messenger?sslmode=disable
REDIS_URL: redis://redis:6379/0
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
CACHE_MODE: ${CACHE_MODE:-versioned}
SESSION_STORE: ${SESSION_STORE:-redis}
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health/ready"]
interval: 5s
timeout: 3s
retries: 5
volumes:
postgres_data:
name: mtusi_postgres_data
redis_data:
name: mtusi_redis_data