services:

  postgres:
    image: postgres:${PG_VERSION}
    environment:
      - PG_VERSION=latest
      - POSTGRES_PASSWORD=secret
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 10s
      timeout: 5s
      retries: 5

  pg_back:
    build: ..
    environment:
      - PGPASSWORD=secret
    command: -h postgres -p 5432 -U postgres
    depends_on:
      postgres:
        condition: service_healthy
