name: mtusi-lab2 services: postgres: image: postgres:16.6@sha256:557fea37a744d5f4c8faab304b0a90858b53ab119735a88c131fd19dab802f36 environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password secrets: - postgres_password volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"] interval: 5s timeout: 3s retries: 12 start_period: 10s restart: unless-stopped redis: image: redis:7.4.2@sha256:fbdbaea47b9ae4ecc2082ecdb4e1cea81e32176ffb1dcf643d422ad07427e5d9 command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec", "--dir", "/data"] volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 12 start_period: 5s restart: unless-stopped api: build: . ports: - "127.0.0.1:8080:8080" env_file: - .env secrets: - database_url - cache_url depends_on: postgres: condition: service_healthy redis: condition: service_healthy restart: unless-stopped secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url cache_url: file: ./secrets/cache_url volumes: pgdata: redisdata: