SnapDrop / snapdrop

A Progressive Web App for local file sharing
https://snapdrop.net
GNU General Public License v3.0
18.45k stars 1.68k forks source link

docker compose with existing caddy-docker-proxy #587

Open zilexa opened 1 year ago

zilexa commented 1 year ago

I host multiple services, exposed via https (my own domain) through caddy-docker-proxy . Caddy-docker-proxy uses compose labels to dynamically create the caddy file. This way, you don't need to configure a caddyfile yourself and don't need to run the caddy official image.

I want to host snapdrop in the same way, but it's unclear to me if the nginx service in the example docker-compose.yml is still required?

Or should this be enough:

services:
  caddy:
    container_name: web-proxy
    image: lucaslorentz/caddy-docker-proxy:ci-alpine
    restart: always
    networks: 
      - web-proxy
    environment:
      - CADDY_INGRESS_NETWORKS=web-proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - $DOCKERDIR/web-proxy/caddy_data:/data
      - $DOCKERDIR/web-proxy/config:/config
    extra_hosts:
      - host.docker.internal:host-gateway
    ports:
      - 443:443
      - 80:80
    labels:
      caddy.email: $EMAIL

  node:
    image: "node:lts-alpine"
    networks: 
      - web-proxy
    user: "node"
    working_dir: /home/node/app
    volumes:
      - $DOCKERDIR/snapdrop/server/:/home/node/app
    command: ash -c "npm i && node index.js"
    labels:
      caddy: snap.$DOMAIN
      caddy.reverse_proxy: "{{upstreams 443}}"
      caddy.reverse_proxy.header_up: "Host snap.$DOMAIN"
      caddy.file_server: ""               
      caddy.encode: gzip                    
      caddy.header.Strict-Transport-Security: '"max-age=15768000;"' # Recommended security hardening for fileservers
      caddy.header.X-XSS-Protection: '"1; mode=block;"'