# Test stack: nginx HTTP server + tunnel client
# Usage: docker compose -f docker-compose.test.yml up --build
#
# Exposes:
#   testrst.nixc.us -> nginx (test/test)
services:
  test-http:
    image: nginx:alpine
    restart: always
    volumes:
      - ./test-index.html:/usr/share/nginx/html/index.html:ro
    expose:
      - "80"

  test-tunnel-client:
    build:
      context: .
      target: client
    restart: always
    environment:
      TUNNEL_SERVER: "ingress.nixc.us:2222"
      TUNNEL_DOMAIN: "testrst.nixc.us"
      TUNNEL_PORT: "80"
      TUNNEL_KEY: "/keys/client_key"
      TUNNEL_AUTH_USER: "test"
      TUNNEL_AUTH_PASS: "test"
    volumes:
      - ~/.ssh/ca-userkey:/keys/client_key:ro
    depends_on:
      - test-http
    # Share network namespace with test-http so 127.0.0.1:80 reaches nginx
    network_mode: "service:test-http"
