version: '3' # See https://docs.docker.com/compose/overview/ for more information.
# If you make changes to this file or any related files, apply them by # navigating to the directory that holds this file and run this as root: # docker-compose down; docker-compose up -d
# Create two networks: one for front-end containers that we'll make # publicly accessible to the internet, and one for private back-end. networks: frontend: name: webdav_frontend # Explicitly set network name backend: name: webdav_backend # Explicitly set network name
# Create persistent Docker volumes to preserve important data. # We don't want our data to be lost when restarting containers. volumes: vol-webdav:
# Create our containers. services: # Traefik is a reverse proxy. It handles SSL and passes traffic to # Docker containers via rules you define in docker-compose labels. # Its dashboard is at http://example.com/traefik/ (behind a login). traefik: # https://hub.docker.com/_/traefik/ image: ${BASE_IMAGE_URL}/traefik:latest command: # --api --docker --acme.email="${ACME_EMAIL}" - "--api.dashboard=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--entrypoints.websecure.address=:443" - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true" - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web" - "--certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL}" - "--certificatesresolvers.letsencrypt.acme.storage=/acme.json" restart: always networks: - backend - frontend volumes: - /var/run/docker.sock:/var/run/docker.sock # Access to Docker - ./traefik.toml:/traefik.toml # Traefik configuration - ./acme.json:/acme.json # SSL certificates ports: # Map port 80 and 443 on the host to this container. - "801:80" - "4431:443" labels: # - "traefik.docker.network=webdav_frontend" # - "traefik.enable=true" # - "traefik.frontend.rule=Host:${TRAEFIK_DOMAINS}; PathPrefixStrip:/traefik" # - "traefik.port=8080" # - "traefik.protocol=http" # # Remove next line to disable login prompt for the dashboard. # - "traefik.frontend.auth.basic=${BASIC_AUTH}"
# Docker Compose can read environment variables from this file. # See https://docs.docker.com/compose/env-file/
# Put admin areas behind a login prompt, with username and password # specified here. Run `htpasswd -n admin` to create a password hash # for user "admin". Paste the output here. SSL strongly recommended. # 使用 `htpasswd -n username` 命令生成密码哈希。 BASIC_AUTH=
# Let's Encrypt needs an email address for registration. # 配置 Let's Encrypt 的注册邮箱,不需要在 Let's Encrypt 网站上注册。 ACME_EMAIL= # The Traefik dashboard will be available at these domains. # The URL is http://example.com/traefik/ # You'll need to fill in BASIC_AUTH above. # Traefik 的仪表盘将可通过这些域名访问,要确保该域名能够被解析,不然会报错 TRAEFIK_DOMAINS= # Your WebDAV site will be available at these domains. Every domain # needs DNS records pointing to your server for SSL to work. # 你的 WebDAV 站点将可通过这些域名访问。每个域名都需要 DNS 记录指向你的服务器,以便 SSL 工作。 WEBDAV_DOMAINS=
# Set the URL path where you want your WebDAV site to be. # 设置 WebDAV 站点的 URL 路径,要以 斜杠结尾,否则报错 WEBDAV_LOCATION=/webdav/