question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Caddy docker image fails to build

See original GitHub issue

API Platform version(s) affected: 2.6 (on branch main)

Description
Caddy docker image fails to build when installing API Platform from a template repository as explained in the Installing the Framework docs

How to reproduce
Install Api Platform creating a repository from the default template (that is, using the branch main as base) and run docker-compose up -d

Possible Solution
It seems this error was introduced on branch main after #1747. Reverting the changes in api/Dockerfile seems to work:

RUN xcaddy build \
	--with github.com/dunglas/mercure@main \
        --with github.com/dunglas/mercure/caddy@main \
        --with github.com/dunglas/vulcain/caddy

Additional Context

Step 34/41 : FROM caddy:${CADDY_VERSION}-builder-alpine AS api_platform_caddy_builder
 ---> af0735018b75
Step 35/41 : RUN xcaddy build     --with github.com/dunglas/mercure/caddy     --with github.com/dunglas/vulcain/caddy
 ---> Running in a278156d0c81
2021/01/17 13:29:01 [INFO] Temporary folder: /tmp/buildenv_2021-01-17-1329.761470438
2021/01/17 13:29:01 [INFO] Writing main module: /tmp/buildenv_2021-01-17-1329.761470438/main.go
2021/01/17 13:29:01 [INFO] Initializing Go module
2021/01/17 13:29:01 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
2021/01/17 13:29:01 [INFO] Pinning versions
2021/01/17 13:29:01 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.2.1 
go: downloading github.com/caddyserver/caddy/v2 v2.2.1
go: downloading github.com/caddyserver/certmagic v0.12.0
go: downloading go.uber.org/zap v1.15.0
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading github.com/prometheus/client_golang v1.7.1
go: downloading github.com/klauspost/cpuid v1.2.5
go: downloading github.com/mholt/acmez v0.1.1
go: downloading github.com/miekg/dns v1.1.30
go: downloading github.com/libdns/libdns v0.1.0
go: downloading github.com/golang/protobuf v1.4.2
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/procfs v0.1.3
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading google.golang.org/protobuf v1.24.0
go: downloading github.com/prometheus/common v0.10.0
go: downloading go.uber.org/atomic v1.6.0
go: downloading golang.org/x/net v0.0.0-20200707034311-ab3426394381
go: downloading go.uber.org/multierr v1.5.0
go: downloading golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
2021/01/17 13:29:19 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/dunglas/mercure/caddy 
go: downloading github.com/dunglas/mercure v0.10.4
go: downloading github.com/dunglas/mercure/caddy v0.0.0-20210116211136-309e28fd3d19
go: github.com/dunglas/mercure/caddy upgrade => v0.0.0-20210116211136-309e28fd3d19
go: downloading github.com/dunglas/mercure v0.11.0-rc.2
go: downloading go.uber.org/zap v1.16.0
go: downloading github.com/caddyserver/caddy/v2 v2.3.0
go: downloading github.com/prometheus/client_golang v1.9.0
go: downloading github.com/spf13/viper v1.7.1
go: downloading go.etcd.io/bbolt v1.3.5
go: downloading github.com/unrolled/secure v1.0.8
go: downloading github.com/gorilla/handlers v1.5.1
go: downloading github.com/form3tech-oss/jwt-go v3.2.2+incompatible
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/dgraph-io/ristretto v0.0.3
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/spf13/cast v1.3.1
go: downloading go.uber.org/multierr v1.6.0
go: downloading github.com/magiconair/properties v1.8.4
go: downloading github.com/pelletier/go-toml v1.8.1
go: downloading github.com/google/cel-go v0.6.0
go: downloading golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
go: downloading github.com/klauspost/cpuid v1.3.1
go: downloading github.com/yosida95/uritemplate/v3 v3.0.1
go: downloading github.com/gofrs/uuid v4.0.0+incompatible
go: downloading github.com/golang/protobuf v1.4.3
go: downloading github.com/prometheus/common v0.15.0
go: downloading github.com/caddyserver/certmagic v0.12.1-0.20201215190346-201f83a06067
go: downloading google.golang.org/protobuf v1.25.0
go: downloading google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595
go: downloading golang.org/x/net v0.0.0-20201224014010-6772e930b67b
go: downloading github.com/klauspost/cpuid/v2 v2.0.3
go: downloading github.com/smallstep/certificates v0.15.6
go: downloading github.com/mholt/acmez v0.1.2
go: downloading golang.org/x/sys v0.0.0-20210104204734-6f8348627aad
go: downloading github.com/mitchellh/mapstructure v1.4.0
go: downloading github.com/miekg/dns v1.1.35
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading github.com/prometheus/procfs v0.2.0
go: downloading github.com/lucas-clemente/quic-go v0.19.3
go: downloading github.com/smallstep/cli v0.15.3
go: downloading golang.org/x/text v0.3.4
go: downloading github.com/smallstep/truststore v0.9.6
go: downloading github.com/gorilla/mux v1.8.0
go: downloading gopkg.in/ini.v1 v1.62.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading go.uber.org/atomic v1.7.0
go: downloading golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
go: downloading github.com/spf13/afero v1.5.1
go: downloading github.com/urfave/cli v1.22.5
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading howett.net/plist v0.0.0-20201203080718-1454fab16a06
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/felixge/httpsnoop v1.0.1
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/marten-seemann/qtls-go1-15 v0.1.1
go: downloading github.com/marten-seemann/qpack v0.2.1
go: downloading github.com/marten-seemann/qtls v0.10.0
go: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
go: downloading github.com/antlr/antlr4 v0.0.0-20210114010855-d34d2e1c271a
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: downloading github.com/manifoldco/promptui v0.8.0
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
go: downloading github.com/russross/blackfriday v1.5.2
go: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/lunixbochs/vtclean v1.0.0
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/smallstep/nosql v0.3.2
go: downloading go.step.sm/crypto v0.8.0
go: downloading github.com/Masterminds/sprig/v3 v3.2.0
go: downloading go.step.sm/cli-utils v0.1.0
go: downloading github.com/dgraph-io/badger v1.6.2
go: downloading github.com/mitchellh/copystructure v1.0.0
go: downloading github.com/Masterminds/goutils v1.1.0
go: downloading github.com/google/uuid v1.1.4
go: downloading github.com/huandu/xstrings v1.3.2
go: downloading github.com/shopspring/decimal v1.2.0
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/imdario/mergo v0.3.11
go: downloading github.com/mitchellh/reflectwalk v1.0.1
go: downloading gopkg.in/square/go-jose.v2 v2.5.1
go: downloading github.com/dgraph-io/badger/v2 v2.2007.2
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96
go: downloading github.com/Masterminds/semver/v3 v3.1.1
go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
go: downloading github.com/DataDog/zstd v1.4.5
go: downloading github.com/golang/snappy v0.0.2
2021/01/17 13:30:11 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/dunglas/vulcain/caddy 
go: downloading github.com/dunglas/vulcain v0.3.0
go: downloading github.com/dunglas/vulcain/caddy v0.0.0-20201227223937-faa9c30e4933
go: github.com/dunglas/vulcain/caddy upgrade => v0.0.0-20201227223937-faa9c30e4933
go: downloading github.com/dunglas/vulcain v0.2.2-0.20200924100508-9fc1c0b9ae2f
go: downloading github.com/getkin/kin-openapi v0.22.1
go: downloading github.com/tidwall/gjson v1.6.1
go: downloading github.com/tidwall/sjson v1.1.2
go: downloading github.com/dunglas/httpsfv v0.1.0
go: downloading github.com/tidwall/match v1.0.1
go: downloading github.com/tidwall/pretty v1.0.2
go: downloading github.com/ghodss/yaml v1.0.0
2021/01/17 13:30:16 [INFO] Build environment ready
2021/01/17 13:30:16 [INFO] Building Caddy
2021/01/17 13:30:16 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath 
go: downloading github.com/go-chi/chi v4.1.2+incompatible
go: downloading github.com/jsternberg/zap-logfmt v1.2.0
go: downloading github.com/yuin/goldmark v1.3.1
go: downloading github.com/alecthomas/chroma v0.8.2
go: downloading github.com/klauspost/compress v1.11.7
go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
go: downloading github.com/rs/xid v1.2.1
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/naoina/toml v0.1.1
go: downloading github.com/sirupsen/logrus v1.7.0
go: downloading github.com/naoina/go-stringutil v0.1.0
go: downloading github.com/dlclark/regexp2 v1.4.0
go: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
# github.com/dunglas/mercure/caddy
/go/pkg/mod/github.com/dunglas/mercure/caddy@v0.0.0-20210116211136-309e28fd3d19/caddy.go:124:8: undefined: mercure.TopicSelectorStoreDefaultCacheNumCounters
/go/pkg/mod/github.com/dunglas/mercure/caddy@v0.0.0-20210116211136-309e28fd3d19/caddy.go:130:8: undefined: mercure.TopicSelectorStoreCacheMaxCost
/go/pkg/mod/github.com/dunglas/mercure/caddy@v0.0.0-20210116211136-309e28fd3d19/caddy.go:135:14: undefined: mercure.NewTopicSelectorStore
/go/pkg/mod/github.com/dunglas/mercure/caddy@v0.0.0-20210116211136-309e28fd3d19/caddy.go:147:41: too many arguments in call to mercure.NewTransport
/go/pkg/mod/github.com/dunglas/mercure/caddy@v0.0.0-20210116211136-309e28fd3d19/caddy.go:160:3: undefined: mercure.WithTopicSelectorStore
2021/01/17 13:31:50 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2021-01-17-1329.761470438
2021/01/17 13:31:50 [FATAL] exit status 2
ERROR: Service 'caddy' failed to build : The command '/bin/sh -c xcaddy build     --with github.com/dunglas/mercure/caddy     --with github.com/dunglas/vulcain/caddy' returned a non-zero code: 1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dunglascommented, Jan 17, 2021

It’s because I’m working on a new release of Mercure. This should b fixed soon. In the meantime, adding --with github.com/dunglas/mercure@main after this line https://github.com/api-platform/api-platform/blob/main/api/Dockerfile#L117 should fix the build.

0reactions
dunglascommented, Jan 26, 2021

Get "https://proxy.golang.org/github.com/caddyserver/caddy/v2/@v/v2.3.0.info": dial tcp 74.125.23.141:443: connect: connection refused 2021/01/26 11:33:25

Your computer doesn’t manage to connect to Google’s proxy. Try again. If the problem persists try to report to the Go project or to your network provider.

Sorry but there is really nothing we can do on our side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Service 'caddy' failed to build: manifest for caddy/caddy:v1.0.4 ...
Hi All, After deploying docker stack the service of monitoring_caddy is showing 0/1 that means container is restarting or excited below is ...
Read more >
caddy - Official Image | Docker Hub
Building your own Caddy-based image. Most users deploying production sites will not want to rely on mounting files into a container, but will...
Read more >
Trying to run caddy in docker using the official image, but I'm ...
I'm trying to run the official caddy docker image here on a fresh install: https://hub.docker.com/_/caddy I'm getting the following error ...
Read more >
Docker from scratch CMD bug - caddy - Stack Overflow
This means that normal shell processing does not happen. For example, CMD [ "echo", "$HOME" ] will not do variable substitution on $HOME....
Read more >
Caddy - Official Image | Docker Hub
Building your own Caddy-based image. Most users deploying production sites will not want to rely on mounting files into a container, but will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found