version: "3.8"

services:
  obfs4-bridge:
    image: r3bo0tbx1/onion-relay:latest
    container_name: obfs4-bridge
    restart: unless-stopped
    network_mode: host
    environment:
      - OR_PORT=${OR_PORT:-9001}
      - PT_PORT=${PT_PORT:-9002}
      - EMAIL=${EMAIL:?EMAIL is required}
      - NICKNAME=${NICKNAME:-DockerObfs4Bridge}
      - OBFS4_ENABLE_ADDITIONAL_VARIABLES=${OBFS4_ENABLE_ADDITIONAL_VARIABLES:-1}
      - OBFS4V_AddressDisableIPv6=${OBFS4V_AddressDisableIPv6:-0}
      - OBFS4V_MaxMemInQueues=${OBFS4V_MaxMemInQueues:-1024 MB}
      - OBFS4V_BandwidthRate=10 MBytes
      - OBFS4V_BandwidthBurst=20 MBytes
      - OBFS4V_AccountingMax=100 GBytes
      - OBFS4V_AccountingStart=month 1 00:00
      - TZ=${TZ:-UTC}
    volumes:
      - obfs4-data:/var/lib/tor
      - obfs4-logs:/var/log/tor
    security_opt:
      - no-new-privileges:true
    cap_add:
      - NET_BIND_SERVICE
      - CHOWN
      - SETUID
      - SETGID
      - DAC_OVERRIDE
    cap_drop:
      - ALL
    healthcheck:
      test: ["CMD-SHELL", "/usr/local/bin/healthcheck.sh"]
      interval: 60s
      timeout: 10s
      retries: 3
      start_period: 120s
    labels:
      com.centurylinklabs.watchtower.enable: "true"
      description: "Tor obfs4 Bridge - Drop-in replacement for thetorproject/obfs4-bridge"
      version: "1.1.7"
      maintainer: "rE-Bo0t.bx1 <r3bo0tbx1@brokenbotnet.com>"

volumes:
  obfs4-data:
    name: tor-datadir-${OR_PORT:-9001}-${PT_PORT:-9002}
    driver: local
  obfs4-logs:
    name: tor-logs-${OR_PORT:-9001}-${PT_PORT:-9002}
    driver: local