lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
2.85k stars 169 forks source link

Custom images #626

Closed sowinski closed 3 months ago

sowinski commented 4 months ago
ARG CADDY_VERSION=2.6.1
FROM caddy:${CADDY_VERSION}-builder AS builder

RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/v2 \
    --with <additional-plugins>

FROM caddy:${CADDY_VERSION}-alpine

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

CMD ["caddy", "docker-proxy"]

I want to add to caddy-docker-proxy a rate limit plugin.

Is the first line of code setting the CADDY_VERSION or the CADDY_DOCKER_PROXY version?

If it is setting the CADDY_VERSION, "--with github.com/lucaslorentz/caddy-docker-proxy/v2 \" is this line then using the latest master branch from caddy docker proxy? Shouldn't we be able to also add here a specific version?

francislavoie commented 4 months ago

It's the Caddy version. You should use the latest Caddy version, the one in the readme is just an example (it was the latest at the time of writing).

Yes you can choose a CDP version by suffixing @<version>. See the xcaddy docs.

sowinski commented 3 months ago

Okay thank you.

For the current build I used this:

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

RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.9.1 \
    --with github.com/mholt/caddy-ratelimit@b188193608fbe262c225d556090b9c869a66bb44

FROM caddy:${CADDY_VERSION}-alpine

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

CMD ["caddy", "docker-proxy"]

I choose the correct Caddy and Caddy-docker-proxy version from your release notes.