Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker compose with existing caddy-docker-proxy #587

Open
zilexa opened this issue Apr 1, 2023 · 0 comments
Open

docker compose with existing caddy-docker-proxy #587

zilexa opened this issue Apr 1, 2023 · 0 comments

Comments

@zilexa
Copy link

zilexa commented Apr 1, 2023

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;"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant