Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building Docker image with the Caddy module #189

Closed
FPDK opened this issue Oct 24, 2024 · 2 comments · Fixed by #190
Closed

Error building Docker image with the Caddy module #189

FPDK opened this issue Oct 24, 2024 · 2 comments · Fixed by #190

Comments

@FPDK
Copy link

FPDK commented Oct 24, 2024

Hi,

When I execute this Dockerfile (Docker v. 4.23.0):

ARG CADDY_VERSION=2.8.4

FROM caddy:${CADDY_VERSION}-builder AS builder

RUN xcaddy build --with github.com/protomaps/go-pmtiles/caddy

FROM caddy:${CADDY_VERSION}-alpine

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

# Copy Caddyfile and .pmtiles into the container
COPY Caddyfile .
COPY monaco-latest.pmtiles .

# Expose the port that Caddy will run on
EXPOSE 80
EXPOSE 8080
EXPOSE 443

# Start Caddy
CMD ["caddy", "run", "--config", "Caddyfile"]

I get this error during the build step:

=> ERROR [builder 2/2] RUN xcaddy build --with github.com/protomaps/go-pmtiles/caddy                                                                                                                110.9s
------                                                                                                                                                                                                      
 > [builder 2/2] RUN xcaddy build --with github.com/protomaps/go-pmtiles/caddy:                                                                                                                             
...
70.96 go: downloading github.com/spaolacci/murmur3 v1.1.0
71.05 2024/10/24 11:06:22 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath -tags nobadger 
92.94 # go.opentelemetry.io/otel/sdk/trace
92.94 /go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:165:20: cannot use (*recordingSpan)(nil) (value of type *recordingSpan) as ReadWriteSpan value in variable declaration: *recordingSpan does not implement ReadWriteSpan (missing method AddLink)
92.94           have addLink("go.opentelemetry.io/otel/trace".Link)
92.94           want AddLink("go.opentelemetry.io/otel/trace".Link)
92.94 /go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:804:20: cannot use nonRecordingSpan{} (value of type nonRecordingSpan) as "go.opentelemetry.io/otel/trace".Span value in variable declaration: nonRecordingSpan does not implement "go.opentelemetry.io/otel/trace".Span (missing method AddLink)
92.94 /go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/tracer.go:50:21: impossible type assertion: p.(*recordingSpan)
92.94   *recordingSpan does not implement "go.opentelemetry.io/otel/trace".Span (missing method AddLink)
92.94           have addLink("go.opentelemetry.io/otel/trace".Link)
92.94           want AddLink("go.opentelemetry.io/otel/trace".Link)
92.94 /go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/tracer.go:120:10: cannot use tr.newNonRecordingSpan(sc) (value of type nonRecordingSpan) as "go.opentelemetry.io/otel/trace".Span value in return statement: nonRecordingSpan does not implement "go.opentelemetry.io/otel/trace".Span (missing method AddLink)
92.94 /go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/tracer.go:122:9: cannot use tr.newRecordingSpan(psc, sc, name, samplingResult, config) (value of type *recordingSpan) as "go.opentelemetry.io/otel/trace".Span value in return statement: *recordingSpan does not implement "go.opentelemetry.io/otel/trace".Span (missing method AddLink)
92.94           have addLink("go.opentelemetry.io/otel/trace".Link)
92.94           want AddLink("go.opentelemetry.io/otel/trace".Link)
110.5 2024/10/24 11:07:01 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2024-10-24-1105.232989868
110.5 2024/10/24 11:07:01 [FATAL] exit status 1
------
Dockerfile:5
--------------------
   3 |     FROM caddy:${CADDY_VERSION}-builder AS builder
   4 |     
   5 | >>> RUN xcaddy build --with github.com/protomaps/go-pmtiles/caddy
   6 |     
   7 |     FROM caddy:${CADDY_VERSION}-alpine
--------------------
ERROR: failed to solve: process "/bin/sh -c xcaddy build --with github.com/protomaps/go-pmtiles/caddy" did not complete successfully: exit code: 1

I have attached the full log:
docker-caddy-log.log

When I don't include the go-pmtiles module (i.e. remove the --with argument) the build-step executes without errors.
I have tried building with another custom module (github.com/dunglas/mercure/caddy) and this works fine as well.

Am I doing something wrong?

@bdon bdon closed this as completed in #190 Oct 24, 2024
bdon added a commit that referenced this issue Oct 24, 2024
…auth fix (#190)

* fix mismatched opentelemetry SDK version [#189]

* bump gocloud to v0.40.0 with azure authentication fix
@bdon
Copy link
Member

bdon commented Oct 24, 2024

Thanks for the detailed report. Should be fixed on main and in v1.22.1, can you try that?

@FPDK
Copy link
Author

FPDK commented Oct 25, 2024

It works fine now. Thank you for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants