services:
  migrate:
    image: who-need-help:e2e
    pull_policy: never
    build:
      args:
        WNH_E2E_ROUTES: "true"

  web:
    image: who-need-help:e2e
    pull_policy: never
    labels:
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.rule=${TRAEFIK_ROUTER_RULE}
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.entrypoints=websecure
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.service=${TRAEFIK_APP_NAME}
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.middlewares=${TRAEFIK_APP_NAME}-retry
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.tls=true

  worker:
    image: who-need-help:e2e
    pull_policy: never

  e2e:
    image: who-need-help-e2e-tests:local
    build:
      context: e2e
    init: true
    ipc: host
    user: "${E2E_UID:-1000}:${E2E_GID:-1000}"
    environment:
      BASE_URL: ${E2E_BASE_URL:?Set E2E_BASE_URL in the generated E2E environment}
      MAILPIT_URL: ${E2E_MAILPIT_URL:?Set E2E_MAILPIT_URL in the generated E2E environment}
      HOME: /tmp
      CI: ${CI:-}
      NO_PROXY: web,mailpit,db,proxy,localhost,127.0.0.1
      no_proxy: web,mailpit,db,proxy,localhost,127.0.0.1
    depends_on:
      web:
        condition: service_healthy
      mailpit:
        condition: service_started
    volumes:
      - ${E2E_OUTPUT_DIR:?Set an ignored E2E_OUTPUT_DIR}:/work/output
    # The browser needs the application/data plane on `internal` and the
    # Traefik service on `ingress`. Both networks are internal in compose.yaml,
    # so the isolated E2E runner still has no route to the public Internet.
    networks: [internal, ingress]
