this post was submitted on 23 Jun 2026
20 points (100.0% liked)

Selfhosted

61236 readers
164 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I'm looking into setting up https for my local services. Everything is currently set up using the official caddy docker image.

I want to use now connect caddy to cloudflare to resolve the DNS 01. It looks like this is possible with a drop in replacement for caddy from either https://github.com/CaddyBuilds/caddy-cloudflare or https://github.com/serfriz/caddy-custom-builds

Is anyone here using these builds? Are they reliable? Is there an alternative I havent considered?

you are viewing a single comment's thread
view the rest of the comments
[–] ryper@lemmy.ca 4 points 1 month ago (3 children)

You could just build it yourself, there's not much to it.

Dockerfile:

ARG VERSION=2

FROM caddy:${VERSION}-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${VERSION}

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

My Dockerfile is under dockerfile-dns and then in docker-compose.yaml instead of pointing to an image I have:

services:
  caddy:
    build: ./dockerfile-dns

I'm not 100% sure of the right way to update it, but I think I usually use something like docker compose build --pull --no-cache.

[–] anytimesoon@piefed.social 2 points 1 month ago (2 children)

This is basically the dockerfile these projects provide, so I guess I could do this myself. How do you keep the caddy container up to date? I have tugtainer (something like watchtower) update caddy automatically, but I guess this set up would break that

[–] irmadlad@lemmy.world 1 points 1 month ago (1 children)

I have tugtainer (something like watchtower) update caddy automatically, but I guess this set up would break that

Does tugtainer (always makes me giggle) have to ability to label containers for exclusion like watchtower does?

[–] anytimesoon@piefed.social 1 points 1 month ago (1 children)

Yup. It's basically watchtower with a gui

[–] irmadlad@lemmy.world 2 points 1 month ago

Well, what I was thinking/spitballing is that you could label your Caddy container, do updates on everything else. That leaves Caddy to administer when you can devote 15/20 minutes to rebuilding the Caddy container by itself. Not the most graceful, automated solution, but........

[–] ryper@lemmy.ca 1 points 1 month ago

I can't help you with automation. I update my containers manually, whenever I think to do it. Nothing is accessible outside my network so I'm not worried about staying on top of security updates.

[–] hellmo_luciferrari@lemmy.zip 2 points 1 month ago* (last edited 1 month ago)

I have a Dockerifle like that:

ARG CADDY_VERSION=2.11.3
FROM caddy:${CADDY_VERSION}-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${CADDY_VERSION}-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

and the docker-compose.yml file I use:

services:
  caddy:
    pull_policy: build
    build:
      context: .

And to build new versions I modify the Dockerfile after doing a docker compose down, and then to build the new version I use docker compose up.

I'm not entirely sure, but I think you can skip the "--no-cache" as it seems to still check for image updates. It helps to speed things up, especially if you check for updates more frequently.