services: postgres: image: postgres:17.6 environment: POSTGRES_DB: messenger POSTGRES_USER: lab2 POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password secrets: - postgres_password volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U lab2 -d messenger"] interval: 5s timeout: 3s retries: 10 start_period: 5s api: build: context: . dockerfile: Dockerfile secrets: - database_url depends_on: postgres: condition: service_healthy ports: - "8080:8080" secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url volumes: postgres_data: