# Nginx Reverse Proxy for Local Development
#
# This is OPTIONAL - only for local development
# AWS uses bare metal nginx instead
#
# Usage:
#   docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
#
# Before using:
#   1. Generate nginx config: cd ../ctrl/server && ./setup.sh --local
#   2. Stop bare metal nginx: sudo systemctl stop nginx (if installed)
#
# This nginx container will:
#   - Listen on port 80
#   - Route amarmascotas.local.com to amar frontend/backend
#   - Route soleprint.local.com to soleprint services

services:
  nginx:
    image: nginx:alpine
    container_name: ${DEPLOYMENT_NAME}_nginx
    ports:
      - "80:80"
    volumes:
      # Mount template that will be processed with envsubst
      - ../ctrl/server/nginx/docker-local.conf:/etc/nginx/templates/default.conf.template:ro
      # Mount wrapper files for serving
      - ../wrapper:/app/wrapper:ro
    env_file:
      - .env
    environment:
      - DEPLOYMENT_NAME=${DEPLOYMENT_NAME}
      - ROOM_NAME=${ROOM_NAME}
      - MANAGED_DOMAIN=${MANAGED_DOMAIN}
      - SOLEPRINT_DOMAIN=${SOLEPRINT_DOMAIN}
    networks:
      - default
    depends_on:
      - soleprint
    restart: unless-stopped

networks:
  default:
    external: true
    name: ${NETWORK_NAME}
