name: mtusi-lab2 x-api: &api image: mtusi-lab2-api:local environment: &api-env APP_HOST: 0.0.0.0 APP_PORT: 8080 APP_ENV: lab SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} SESSION_STORE: postgres DATABASE_URL_FILE: /run/secrets/database_url CACHE_URL_FILE: /run/secrets/cache_url secrets: [database_url, cache_url] depends_on: postgres: {condition: service_healthy} valkey: {condition: service_healthy} cpus: 1.0 mem_limit: 512m restart: unless-stopped services: api: <<: *api build: . ports: ["127.0.0.1:${API_PORT:-8080}:8080"] postgres: image: postgres:16.8-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: 2s retries: 20 cpus: 1.0 mem_limit: 512m restart: unless-stopped valkey: image: valkey/valkey:8.0.2-alpine command: [valkey-server, --appendonly, "yes", --appendfsync, everysec, --maxmemory, 96mb, --maxmemory-policy, allkeys-lru] volumes: [valkey_data:/data] healthcheck: test: [CMD, valkey-cli, ping] interval: 2s timeout: 2s retries: 15 cpus: 0.5 mem_limit: 128m restart: unless-stopped api-expiry: <<: *api profiles: [test] environment: <<: *api-env SESSION_TTL_SECONDS: 2 restart: "no" tools: image: mtusi-lab2-tools:local profiles: [test] build: {context: ., dockerfile: infra/Dockerfile.tools} working_dir: /workspace volumes: - .:/workspace - /var/run/docker.sock:/var/run/docker.sock environment: BASE_URL: http://api:8080 cpus: 1.0 mem_limit: 512m secrets: postgres_password: {file: ./secrets/postgres_password} database_url: {file: ./secrets/database_url} cache_url: {file: ./secrets/cache_url} volumes: postgres_data: valkey_data: