version: "3.6"
services:

  <<projectName>>-api:
    image: cosmtrek/air:v1.49.0
    container_name: <<projectName>>-api
    working_dir: /app
    env_file:
      - .env
    environment:
      - # container internal port (not exposed to host)
      - PORT=8080
      - air_wd=/app
      - <<dbNameKey>>=<<projectName>>
      - <<dbUserKey>>=databaseUser
      - <<dbPassword>>=databasePw1!
      - <<dbHost>>=db
      - DEBUGGER_ARGS=${DEBUGGER_ARGS}
    ports:
      # debugger port
      - "40000:40000"
    volumes:
      - ./<<projectName>>-api:/app
      - ./config/healthcheck.sh:/opt/healthcheck/healthcheck.sh
    networks:
      - <<projectName>>-net
    depends_on:
      db:
        condition: service_healthy
    healthcheck:
      # due to the way the api authorizes requests, we expect a 401
      test: /opt/healthcheck/healthcheck.sh http://localhost:$$PORT/api/docs 401
      timeout: 30s
      retries: 10
      start_period: 30s
