caddy-dns / cloudflare

Caddy module: dns.providers.cloudflare
Apache License 2.0
436 stars 59 forks source link

Deploying a caddy+cloudflare image #43

Closed aTable closed 2 years ago

aTable commented 2 years ago

As mentioned in issue 24 it's simple enough to create a custom build of caddy including the cloudflare module. Is there any interest to also ship an official version as part of the range of caddy?

It would be convenient if you only had to do a docker pull docker.io/caddy:cloudflare

mholt commented 2 years ago

Thanks for the question/interest! You're welcome to publish such an image for people to use, but we are not planning on it.

aTable commented 2 years ago

Happy to raise the PR, are you saying it wont happen in this repo and to do it in my own?

mholt commented 2 years ago

Yep. There are too many DNS providers and it doesn't make much sense for us to try to officially favor one (or especially all of them equally) and publish singular images with just that plugin. But the community is welcome to contribute whatever they'd like for others to use!

aTable commented 2 years ago

for any future readers: I have forked this repo to deploy an image for convenience. I have only briefly tested so far but its working fine for wildcard certs. To use:

Example Caddyfile thanks to reinhardt

{
    debug
    email {env.CLOUDFLARE_EMAIL}
}

*.mydomain.com
 {
    tls {
        dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    }  
    @home host home.mydomain.com
    handle @home {
        root * /sites/home_site
                file_server
    }
     @jellyfin host jellyfin.mydomain.com
    handle @jellyfin {
          reverse_proxy jellyfin:8096 
    }
}

Sample run command docker run --name caddy --volume /path/to/Caddyfile:/etc/Caddy/Caddyfile -e CLOUDFLARE_EMAIL='youremail@example.com' -e CLOUDFLARE_API_TOKEN='your_api_token_with_correct_zone_and_dns_permissions' ghcr.io/atable/cloudflare:master