name: mtusi-lab2 services: api: build: . ports: - "127.0.0.1:${APP_PORT:-8080}:8080" environment: DATABASE_URL_FILE: /run/secrets/database_url CACHE_URL_FILE: /run/secrets/cache_url SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: - database_url - cache_url depends_on: postgres: condition: service_healthy redis: condition: service_healthy mem_limit: 256m cpus: 1 stop_grace_period: 10s postgres: image: postgres:17.2-bookworm@sha256:3267c505060a0052e5aa6e5175a7b41ab6b04da2f8c4540fc6e98a37210aa2d3 environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password secrets: - postgres_password volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"] interval: 3s timeout: 2s retries: 20 mem_limit: 512m cpus: 1 redis: image: redis:7.4.1-bookworm@sha256:bb142a9c18ac18a16713c1491d779697b4e107c22a97266616099d288237ef47 command: ["redis-server", "--maxmemory", "32mb", "--maxmemory-policy", "allkeys-lru", "--save", "", "--appendonly", "no"] healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 3s timeout: 2s retries: 20 mem_limit: 64m cpus: 0.5 volumes: postgres_data: secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url cache_url: file: ./secrets/cache_url