version: "3"

services:
  caddy:
    image: caddy:latest
    container_name: caddy
    restart: always
    links:
      - v2ray
    ports:
      - "443:443"
      - "443:443/udp"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config

  v2ray:
    image: v2fly/v2fly-core:v4.45.2
    container_name: v2ray
    restart: always
    volumes:
      - ./v2ray-config.json:/etc/v2ray/config.json
      #以下为 Trojan TLS相关
      #冒号后面地址与django-spanel中配置地址一致,冒号前为服务器上cert和key所在真实地址
      #-/path/to/cert:/path/to/cert
      #-/path/to/key:/path/to/key
    ports:
      - "10086:10086"
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
    command: ["v2ray","-config="]

  v2scar:
    container_name: v2scar
    image: ehco1996/v2scar
    restart: always
    depends_on:
      - v2ray
    links:
      - v2ray
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
    environment:
      V2SCAR_SYNC_TIME: 60
      V2SCAR_API_ENDPOINT: ""
      V2SCAR_GRPC_ENDPOINT: "v2ray:8080"
volumes:
  caddy_data:
  caddy_config: