services:
  tailscale:
    image: tailscale/tailscale:latest
    environment:
      - TS_HOSTNAME=tailscale-docker
      - TS_AUTH_ONCE=true
      - TS_STATE_DIR=/data
      - TS_USERSPACE=true
    volumes:
      - tailscale:/var/run/tailscale
      - tailscale_data:/data
    networks:
      - 1panel-network
    command: tailscaled --tun=userspace-networking --socks5-server=localhost:1055
  
  derper:
    image: ghcr.io/yangchuansheng/ip_derper:latest
    container_name: ${CONTAINER_NAME}
    restart: always
    networks:
      - 1panel-network
    ports:
      - "${PANEL_APP_PORT_TCP}:443"
      - "${PANEL_APP_PORT_UDP}:3478/udp"
    volumes:
      - tailscale:/var/run/tailscale
    environment:
      - DERP_VERIFY_CLIENTS=${DERP_VERIFY_CLIENTS:-true}
    depends_on:
      - tailscale
    labels:  
      createdBy: "Apps"

volumes:
  tailscale:
  tailscale_data:

networks:  
  1panel-network:  
    external: true