services:
  ipv6nat:
    image: robbertkl/ipv6nat
    container_name: ipv6nat
    restart: unless-stopped
    network_mode: host
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /lib/modules:/lib/modules:ro

  shadowsocks:
    image: shadowsocks/shadowsocks-libev:edge
    expose:
      - 8388
      - 8388/udp
    environment:
      - METHOD=chacha20-ietf-poly1305
      - PASSWORD=replace with your password,Better to replace with UUID,no quote!!
      - DNS_ADDRS=8.8.8.8,1.1.1.1 # for ipv4
#      - DNS_ADDRS=2001:4860:4860::8888,2001:4860:4860::8844     # for ipv6
#      - ARGS= -s ::0   #for ipv6
    restart: always
    networks:
      - backend
    depends_on:
      - ipv6nat

  openresty:
    image: openresty/openresty:latest
    ports:
      - "80:80"
      - "443:443"
      - "7777:7777"
      - "7777:7777/udp"
    volumes:
      - ./nginx.conf:/etc/openresty/nginx.conf
      - ./allow.list:/etc/openresty/allow.list
      - ./auth:/etc/openresty/auth
    restart: always
    networks:
      - backend
    depends_on:
      - ipv6nat
      - shadowsocks

networks:
  backend:
    enable_ipv6: true
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: fd00:cafe:face::/48