services: postgres: image: postgres:16.2-alpine environment: POSTGRES_USER: appuser POSTGRES_PASSWORD: apppassword POSTGRES_DB: messenger_db volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U appuser -d messenger_db"] interval: 5s timeout: 3s retries: 5 restart: unless-stopped redis: image: redis:7.2.4-alpine command: redis-server --appendonly yes volumes: - redis_data:/data ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 restart: unless-stopped api: build: context: . dockerfile: Dockerfile image: mtusi-messenger:lab2 env_file: - .env volumes: - ./secrets:/run/secrets:ro - ./scripts:/app/scripts:ro ports: - "8080:8080" depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"] interval: 5s timeout: 3s retries: 5 restart: unless-stopped volumes: postgres_data: name: mtusi2026lab2_postgres_data redis_data: name: mtusi2026lab2_redis_data