services:
  db:
    image: postgres:alpine
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: timestamps
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
  backend:
    image: '${COMPOSE_TARGET-docker.pkg.github.com/anime-skip/backend/api:prod}'
    ports:
      - 8080:8080
    env_file: .env.backend
    environment:
      PORT: '8080'
    depends_on:
      db:
        condition: service_healthy
    links:
      - db
    extra_hosts:
      - 'host.docker.internal:host-gateway'
