caddy-dns / cloudflare

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

Building Doesn't work with the Latest Caddy Version 2.7.2 #63

Closed mhmdksh closed 1 year ago

mhmdksh commented 1 year ago

I'm getting this error:

#0 6.217 2023/08/14 10:02:33 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v github.com/caddy-dns/cloudflare github.com/caddyserver/caddy/v2@v2.7.2
#0 6.376 go: downloading github.com/caddy-dns/cloudflare v0.0.0-20230807034102-74f004e1c1ab
#0 6.445 go: github.com/caddy-dns/cloudflare@upgrade (v0.0.0-20230807034102-74f004e1c1ab) requires github.com/caddyserver/caddy/v2@v2.7.3, not github.com/caddyserver/caddy/v2@v2.7.2
#0 6.450 2023/08/14 10:02:33 [FATAL] exit status 1
------
failed to solve: process "/bin/sh -c xcaddy build     --with github.com/caddy-dns/cloudflare" did not complete successfully: exit code: 1

While building with the lates Caddy Image from Dockerhub (Which is 2.7.2) at the time of opening this issue.

My Dockerfile:

# Build Cloudflare DNS Package
FROM caddy:2-builder-alpine AS builder
RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

# Modify Binary from Main Package
FROM caddy:2-alpine
# Install envsubst (part of gettext package)
RUN apk add --no-cache gettext
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
COPY ./Caddyfile /etc/caddy/Caddyfile

This is a serious bug, there is a mismatch between the package requirement, and the Dockerhub version release

mhmdksh commented 1 year ago

UPDATE: I also found that there is a mismatch between Caddy release on Github (2.7.3) vs Dockerhub (2.7.2)

OlafZwe commented 1 year ago

Caddy on Dockerhub being a week out of date and not having Caddy 2.7.3 yet is a problem for using Caddy in production and Dockerhub should probably be updated automatically on a new Caddy release on Github, especially if dependencies are updated in (otherwise unchanged) modules like this one. Additionally, modules like this one should probably be able to support multiple versions of Caddy, like 2.6 and 2.7, at the very least through version tagging on Github as currently this module is not version tagged.

For a workaround in the meantime, specify the previous commit (a9d3ae2690a1d232bc9f8fc8b15bd4e0a6960eec) of this caddy-dns/cloudflare module in the xcaddy build --with command in your Dockerfile, like so:

FROM caddy:2.6-builder AS builder

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

FROM caddy:2.6

COPY --from=builder /usr/bin/caddy /usr/bin/caddy
mholt commented 1 year ago

Duplicate of https://github.com/caddyserver/caddy-docker/issues/307

And https://github.com/caddyserver/caddy-docker/issues/317

In the future, please don't create multiple issues for the same thing, especially when it's already a duplicate that 5x over all week.