# Development stack (DOCKER_SPEC §1). Contributors need only Docker — Astro HMR and
# the relay with dotnet watch, with /api/contact proxied by the Astro dev server.

services:
  site-dev:
    image: node:22-alpine
    working_dir: /app
    command: sh -c "corepack enable && pnpm install && pnpm dev --host --port 4321"
    environment:
      - ASTRO_TELEMETRY_DISABLED=1
    volumes:
      - ../site:/app
      - site_node_modules:/app/node_modules
    ports:
      - '4321:4321'

  relay-dev:
    image: mcr.microsoft.com/dotnet/sdk:9.0-alpine
    working_dir: /src
    command: sh -c "dotnet watch run --urls http://+:8081 --non-interactive"
    environment:
      - DOTNET_USE_POLLING_FILE_WATCHER=1
      - Smtp__Host=${SMTP_HOST:-}
      - Relay__ToAddress=${RELAY_TO:-dev@example.com}
      - Relay__AllowedOrigin=http://localhost:4321
    volumes:
      - ../relay:/src
    ports:
      - '8081:8081'

volumes:
  site_node_modules:
