Skip to content

Instantly share code, notes, and snippets.

@paulcalabro
Forked from j0sh/Dockerfile.cloudflared
Created March 7, 2024 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulcalabro/8067127722d97615bf89354cac44c704 to your computer and use it in GitHub Desktop.
Save paulcalabro/8067127722d97615bf89354cac44c704 to your computer and use it in GitHub Desktop.
Passing tunnel tokens into cloudflared via Docker Compose secrets
services:
tunnel:
build:
dockerfile: Dockerfile.cloudflared
restart: unless-stopped
secrets:
- tunnel_prod_token
secrets:
tunnel_prod_token:
file: /path/to/tunnel/token
FROM busybox:1.36.1-uclibc as busybox
FROM cloudflare/cloudflared:2023.8.2
COPY --from=busybox /bin/sh /bin/sh
COPY --from=busybox /bin/cat /bin/cat
ENTRYPOINT [ "/bin/sh", "-c", "export TUNNEL_TOKEN=$(cat /run/secrets/tunnel_prod_token) ; cloudflared --no-autoupdate tunnel run" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment