# Docker Compose for deploying drip-server from GitHub Release
#
# Usage:
#   1. Copy this file to your server
#   2. Create .env file with your settings (see .env.example below)
#   3. Run: docker compose -f docker-compose.release.yml up -d
#
# Environment variables (.env.example):
#   DOMAIN=tunnel.example.com
#   AUTH_TOKEN=your-secret-token
#   VERSION=latest
#   TZ=UTC

services:
  drip-server:
    image: ghcr.io/gouryella/drip:${VERSION:-latest}
    container_name: drip-server
    restart: unless-stopped

    ports:
      - "443:443"
      - "20000-20100:20000-20100"  # TCP tunnel ports

    volumes:
      - ./certs:/app/data/certs:ro
      - ./data:/app/data

    environment:
      TZ: ${TZ:-UTC}

    command: >
      server
      --domain ${DOMAIN:-tunnel.localhost}
      --port 443
      --tls-cert /app/data/certs/fullchain.pem
      --tls-key /app/data/certs/privkey.pem
      --token ${AUTH_TOKEN:-}
      --tcp-port-min 20000
      --tcp-port-max 20100

    networks:
      - drip-net

    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"

    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 512M
        reservations:
          cpus: '0.25'
          memory: 64M

    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:443/health"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 10s

networks:
  drip-net:
    driver: bridge
