name: mtusi2026lab2 services: postgres: image: postgres:16.10-bookworm 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: 2s timeout: 3s retries: 30 restart: unless-stopped cpus: 1.0 mem_limit: 256m api: build: . environment: APP_HOST: 0.0.0.0 APP_PORT: 8080 APP_ENV: ${APP_ENV:-lab} SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} DATABASE_URL_FILE: /run/secrets/database_url secrets: - database_url ports: - "127.0.0.1:${APP_PORT:-18082}:8080" depends_on: postgres: condition: service_healthy restart: unless-stopped read_only: true cap_drop: [ALL] security_opt: [no-new-privileges:true] stop_grace_period: 10s cpus: 1.0 mem_limit: 256m volumes: postgres_data: secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url