services:
  proxy-contur:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: proxy-contur
    restart: unless-stopped
    env_file:
      - .env
    ports:
      - "${PORT:-8787}:${PORT:-8787}"
    # This is the only private link from Platform Map Gateway to the VPN
    # egress. The service remains reachable through its existing host port for
    # the legacy Contour integration.
    networks:
      map-egress:
        aliases:
          - nodedc-map-egress
    healthcheck:
      test:
        - CMD-SHELL
        - >
          node -e "fetch('http://127.0.0.1:' + (process.env.PORT || '8787') + '/healthz', { headers: { 'x-proxy-token': process.env.PROXY_TOKEN || '' } })
          .then(r => process.exit(r.ok ? 0 : 1))
          .catch(() => process.exit(1))"
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

networks:
  map-egress:
    name: nodedc-map-egress
