Closed Ninos closed 1 year ago
What error are you getting? Can you be more specific?
Oh yes of course, sry!
Creazy, I tried it with ARG CADDY_VERSION="2.6.1"
and now it's working. With ARG CADDY_VERSION=2
or ARG CADDY_VERSION="2"
I get following error:
Building web
Sending build context to Docker daemon 6.656kB
Step 1/7 : ARG CADDY_VERSION="2"
Step 2/7 : FROM caddy:${CADDY_VERSION}-builder-alpine AS web_caddy_builder
---> 8e9e8161d584
Step 3/7 : RUN xcaddy build --with github.com/dunglas/mercure --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain --with github.com/dunglas/vulcain/caddy
---> Running in b07964a9e58a
2022/09/25 12:14:05 [INFO] Temporary folder: /tmp/buildenv_2022-09-25-1214.2906793209
2022/09/25 12:14:05 [INFO] Writing main module: /tmp/buildenv_2022-09-25-1214.2906793209/main.go
package main
import (
caddycmd "github.com/caddyserver/caddy/v2/cmd"
// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/dunglas/mercure"
_ "github.com/dunglas/mercure/caddy"
_ "github.com/dunglas/vulcain"
_ "github.com/dunglas/vulcain/caddy"
)
func main() {
caddycmd.Main()
}
2022/09/25 12:14:05 [INFO] Initializing Go module
2022/09/25 12:14:05 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
go mod tidy
2022/09/25 12:14:05 [INFO] Pinning versions
2022/09/25 12:14:05 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.5.0
go: downloading github.com/caddyserver/caddy/v2 v2.5.0
go: downloading github.com/caddyserver/certmagic v0.16.1
go: downloading github.com/google/uuid v1.3.0
go: downloading github.com/lucas-clemente/quic-go v0.26.0
go: downloading github.com/prometheus/client_golang v1.12.1
go: downloading go.uber.org/zap v1.21.0
go: downloading golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: downloading github.com/klauspost/cpuid/v2 v2.0.11
go: downloading github.com/libdns/libdns v0.2.1
go: downloading github.com/mholt/acmez v1.0.2
go: downloading github.com/miekg/dns v1.1.46
go: downloading golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2
go: downloading golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.2
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/common v0.32.1
go: downloading github.com/prometheus/procfs v0.7.3
go: downloading golang.org/x/sys v0.0.0-20220209214540-3681064d5158
go: downloading google.golang.org/protobuf v1.27.1
go: downloading github.com/marten-seemann/qpack v0.2.1
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading github.com/onsi/ginkgo v1.16.4
go: downloading go.uber.org/atomic v1.9.0
go: downloading go.uber.org/multierr v1.6.0
go: downloading golang.org/x/tools v0.1.7
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/marten-seemann/qtls-go1-16 v0.1.5
go: downloading github.com/marten-seemann/qtls-go1-17 v0.1.1
go: downloading github.com/marten-seemann/qtls-go1-18 v0.1.1
go: downloading golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/mod v0.4.2
go: downloading github.com/nxadm/tail v1.4.8
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/fsnotify/fsnotify v1.5.1
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.5.0
go: added github.com/caddyserver/certmagic v0.16.1
go: added github.com/cespare/xxhash/v2 v2.1.2
go: added github.com/cheekybits/genny v1.0.0
go: added github.com/fsnotify/fsnotify v1.5.1
go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: added github.com/golang/protobuf v1.5.2
go: added github.com/google/uuid v1.3.0
go: added github.com/klauspost/cpuid/v2 v2.0.11
go: added github.com/libdns/libdns v0.2.1
go: added github.com/lucas-clemente/quic-go v0.26.0
go: added github.com/marten-seemann/qpack v0.2.1
go: added github.com/marten-seemann/qtls-go1-16 v0.1.5
go: added github.com/marten-seemann/qtls-go1-17 v0.1.1
go: added github.com/marten-seemann/qtls-go1-18 v0.1.1
go: added github.com/matttproud/golang_protobuf_extensions v1.0.1
go: added github.com/mholt/acmez v1.0.2
go: added github.com/miekg/dns v1.1.46
go: added github.com/nxadm/tail v1.4.8
go: added github.com/onsi/ginkgo v1.16.4
go: added github.com/prometheus/client_golang v1.12.1
go: added github.com/prometheus/client_model v0.2.0
go: added github.com/prometheus/common v0.32.1
go: added github.com/prometheus/procfs v0.7.3
go: added go.uber.org/atomic v1.9.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.21.0
go: added golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2
go: added golang.org/x/mod v0.4.2
go: added golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
go: added golang.org/x/sys v0.0.0-20220209214540-3681064d5158
go: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go: added golang.org/x/tools v0.1.7
go: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: added google.golang.org/protobuf v1.27.1
go: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
2022/09/25 12:14:21 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/dunglas/mercure github.com/caddyserver/caddy/v2@v2.5.0
go: downloading github.com/dunglas/mercure v0.14.1
go: downloading github.com/prometheus/client_golang v1.13.0
go: downloading go.uber.org/zap v1.22.0
go: downloading github.com/dgraph-io/ristretto v0.1.0
go: downloading github.com/gofrs/uuid v4.2.0+incompatible
go: downloading github.com/golang-jwt/jwt/v4 v4.4.2
go: downloading github.com/gorilla/handlers v1.5.1
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/kevburnsjr/skipfilter v0.0.1
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/spf13/viper v1.12.0
go: downloading github.com/unrolled/secure v1.12.0
go: downloading github.com/yosida95/uritemplate/v3 v3.0.2
go: downloading go.etcd.io/bbolt v1.3.6
go: downloading golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
go: downloading golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced
go: downloading golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664
go: downloading go.uber.org/multierr v1.8.0
go: downloading github.com/prometheus/common v0.37.0
go: downloading github.com/prometheus/procfs v0.8.0
go: downloading google.golang.org/protobuf v1.28.1
go: downloading github.com/felixge/httpsnoop v1.0.3
go: downloading github.com/MauriceGit/skiplist v0.0.0-20211105230623-77f5c8d3e145
go: downloading github.com/RoaringBitmap/roaring v1.2.1
go: downloading github.com/fsnotify/fsnotify v1.5.4
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/spf13/afero v1.9.2
go: downloading github.com/spf13/cast v1.5.0
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
go: downloading github.com/golang/glog v1.0.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/subosito/gotenv v1.4.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.6
go: downloading github.com/pelletier/go-toml v1.9.5
go: downloading github.com/pelletier/go-toml/v2 v2.0.2
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df
go: downloading github.com/mschoch/smat v0.2.0
go: downloading github.com/bits-and-blooms/bitset v1.3.0
go: added github.com/MauriceGit/skiplist v0.0.0-20211105230623-77f5c8d3e145
go: added github.com/RoaringBitmap/roaring v1.2.1
go: added github.com/bits-and-blooms/bitset v1.3.0
go: upgraded github.com/dgraph-io/ristretto v0.0.4-0.20200906165740-41ebdbffecfd => v0.1.0
go: added github.com/dunglas/mercure v0.14.1
go: upgraded github.com/felixge/httpsnoop v1.0.2 => v1.0.3
go: upgraded github.com/fsnotify/fsnotify v1.5.1 => v1.5.4
go: added github.com/gofrs/uuid v4.2.0+incompatible
go: added github.com/golang-jwt/jwt/v4 v4.4.2
go: upgraded github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b => v1.0.0
go: added github.com/gorilla/handlers v1.5.1
go: added github.com/gorilla/mux v1.8.0
go: upgraded github.com/hashicorp/golang-lru v0.5.1 => v0.5.4
go: added github.com/hashicorp/hcl v1.0.0
go: added github.com/kevburnsjr/skipfilter v0.0.1
go: added github.com/magiconair/properties v1.8.6
go: added github.com/mitchellh/mapstructure v1.5.0
go: added github.com/mschoch/smat v0.2.0
go: added github.com/pelletier/go-toml v1.9.5
go: added github.com/pelletier/go-toml/v2 v2.0.2
go: upgraded github.com/prometheus/client_golang v1.12.1 => v1.13.0
go: upgraded github.com/prometheus/common v0.32.1 => v0.37.0
go: upgraded github.com/prometheus/procfs v0.7.3 => v0.8.0
go: added github.com/spf13/afero v1.9.2
go: upgraded github.com/spf13/cast v1.4.1 => v1.5.0
go: added github.com/spf13/jwalterweatherman v1.1.0
go: added github.com/spf13/pflag v1.0.5
go: added github.com/spf13/viper v1.12.0
go: added github.com/subosito/gotenv v1.4.0
go: added github.com/unrolled/secure v1.12.0
go: added github.com/yosida95/uritemplate/v3 v3.0.2
go: upgraded go.uber.org/multierr v1.6.0 => v1.8.0
go: upgraded go.uber.org/zap v1.21.0 => v1.22.0
go: upgraded golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 => v0.0.0-20220722155217-630584e8d5aa
go: upgraded golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd => v0.0.0-20220809184613-07c6da5e1ced
go: upgraded golang.org/x/sys v0.0.0-20220209214540-3681064d5158 => v0.0.0-20220808155132-1c4a2a72c664
go: upgraded golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 => v0.0.0-20220517211312-f3a8303e98df
go: upgraded google.golang.org/protobuf v1.27.1 => v1.28.1
go: added gopkg.in/ini.v1 v1.67.0
go: upgraded gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b => v3.0.1
2022/09/25 12:14:57 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/dunglas/mercure/caddy github.com/caddyserver/caddy/v2@v2.5.0
go: downloading github.com/dunglas/mercure/caddy v0.14.1
go: github.com/dunglas/mercure/caddy@upgrade (v0.14.1) requires github.com/caddyserver/caddy/v2@v2.5.2, not github.com/caddyserver/caddy/v2@v2.5.0
2022/09/25 12:15:07 [FATAL] exit status 1
The command '/bin/sh -c xcaddy build --with github.com/dunglas/mercure --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain --with github.com/dunglas/vulcain/caddy' returned a non-zero code: 1
ERROR: Service 'web' failed to build : Build failed
Seems like a version comparing error? The images get the same version environment value:
Hmm... that log output seems to imply that it's pulling down github.com/caddyserver/caddy/v2@v2.5.0
, which is unexpected...
Can you provide the exact build command you are using?
Also, make sure it's not just a cache issue - try with docker build --no-cache
to make sure.
Yeah of course, I'm running docker-compose build --no-cache web
. My docker-compose.yml
looks something like (cleaned-up):
version: "3.9"
services:
web:
build:
context: ./web/
restart: unless-stopped
volumes:
- caddy_data:/data
- caddy_config:/config
ports:
# HTTP
- target: 80
published: ${HTTP_PORT:-80}
protocol: tcp
# HTTPS
- target: 443
published: ${HTTPS_PORT:-443}
protocol: tcp
# HTTP/3
- target: 443
published: ${HTTP3_PORT:-443}
protocol: udp
volumes:
caddy_data:
caddy_config:
Hmm... This definitely feels like a cache issue, but if you're building with --no-cache
... 😕
Just to test, I altered the Dockerfile
slightly to see if the ARG
being used in one FROM
and not the other made a difference, and to remove the last COPY
:
ARG CADDY_VERSION=2
FROM caddy:${CADDY_VERSION}-builder-alpine AS web_caddy_builder
RUN xcaddy build \
--with github.com/dunglas/mercure \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain \
--with github.com/dunglas/vulcain/caddy
FROM caddy:${CADDY_VERSION}-alpine AS web
WORKDIR /srv/web
COPY --from=web_caddy_builder /usr/bin/caddy /usr/bin/caddy
Here's what I get with docker build
:
$ docker build .
[+] Building 70.5s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 429B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/caddy:2-alpine 0.2s
=> [internal] load metadata for docker.io/library/caddy:2-builder-alpine 0.2s
=> [web_caddy_builder 1/2] FROM docker.io/library/caddy:2-builder-alpine@sha256:fae95a8a86dc6c6677e37545b20c99a15dc9d15eb1d1a9d7940c9312be191a82 1.0s
=> => resolve docker.io/library/caddy:2-builder-alpine@sha256:fae95a8a86dc6c6677e37545b20c99a15dc9d15eb1d1a9d7940c9312be191a82 0.0s
=> => sha256:b1cfb9a383347f93e1ca5321f1c50937244dec8e6609f7e32772d87f6a0cd6d9 8.08kB / 8.08kB 0.0s
=> => sha256:fae95a8a86dc6c6677e37545b20c99a15dc9d15eb1d1a9d7940c9312be191a82 1.43kB / 1.43kB 0.0s
=> => sha256:567cc13145247b792bb6e567367bd340ffd7f43f42f97e924de3c76f6cd7aee9 1.99kB / 1.99kB 0.0s
=> => sha256:c472cbc8629c6e976646511fb3733e0c47037cd0b7505baa1da11468dcbe65c8 6.94MB / 6.94MB 0.6s
=> => sha256:fa4f9925203282ff5a8c3edf171610b258d088c5adf539da3e3be06c1494b0d1 1.22MB / 1.22MB 0.3s
=> => sha256:be1c1a79282019b42f1acacff725798a90ff1dd8073bff9055be0104f0b63cf8 407B / 407B 0.4s
=> => extracting sha256:c472cbc8629c6e976646511fb3733e0c47037cd0b7505baa1da11468dcbe65c8 0.2s
=> => extracting sha256:fa4f9925203282ff5a8c3edf171610b258d088c5adf539da3e3be06c1494b0d1 0.1s
=> => extracting sha256:be1c1a79282019b42f1acacff725798a90ff1dd8073bff9055be0104f0b63cf8 0.0s
=> [web 1/3] FROM docker.io/library/caddy:2-alpine@sha256:21dbf9101c1eae0e2228f386eefab509d462710c2da97ba45d61c083f3e74fc1 1.2s
=> => resolve docker.io/library/caddy:2-alpine@sha256:21dbf9101c1eae0e2228f386eefab509d462710c2da97ba45d61c083f3e74fc1 0.0s
=> => sha256:21dbf9101c1eae0e2228f386eefab509d462710c2da97ba45d61c083f3e74fc1 1.43kB / 1.43kB 0.0s
=> => sha256:c5422fb96d5bf458fc8a8813354de04ef89cdd6750464608c1a79fa516cb3cf0 1.36kB / 1.36kB 0.0s
=> => sha256:7d8159c96a82a85a24bdca751327835b2f572ba3db71f048bfd2a99157c4552a 7.97kB / 7.97kB 0.0s
=> => sha256:fd0c7d01ba8a98bee02450f9f44e2eac5030b38a232f4af1d7c6e816d8230364 304.51kB / 304.51kB 0.1s
=> => sha256:e56da4be4f98aabf384c325fdd5372f380cd5105a18d7cdea0932b91c5dd929e 5.83kB / 5.83kB 0.1s
=> => sha256:5a4205233f1134d23e80cfe1162f65ddc45f5e08ff0e9b0e8e1f567f1df4868e 14.49MB / 14.49MB 0.6s
=> => sha256:1f35320fa0aa0bd407da7446a532e6bb6ff70ffbbb64aba575f0a6e21ccf51ec 154B / 154B 0.2s
=> => extracting sha256:fd0c7d01ba8a98bee02450f9f44e2eac5030b38a232f4af1d7c6e816d8230364 0.1s
=> => extracting sha256:e56da4be4f98aabf384c325fdd5372f380cd5105a18d7cdea0932b91c5dd929e 0.0s
=> => extracting sha256:5a4205233f1134d23e80cfe1162f65ddc45f5e08ff0e9b0e8e1f567f1df4868e 0.5s
=> => extracting sha256:1f35320fa0aa0bd407da7446a532e6bb6ff70ffbbb64aba575f0a6e21ccf51ec 0.0s
=> [web_caddy_builder 2/2] RUN xcaddy build --with github.com/dunglas/mercure --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain --with github.c 68.7s
=> [web 2/3] WORKDIR /srv/web 0.2s
=> [web 3/3] COPY --from=web_caddy_builder /usr/bin/caddy /usr/bin/caddy 0.1s
=> exporting to image 0.2s
=> => exporting layers 0.2s
=> => writing image sha256:41837f07b6d38440c04fbeb6d9f518956ce3eebee5a06dc4835de8af650b1df9 0.0s
And the resulting image contains the right version:
$ docker run -it --rm 41837f07b6d38440c04fbeb6d9f518956ce3eebee5a06dc4835de8af650b1df9 caddy version
v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=
"works on my machine" 😅
My friend, sorry for wasting your time. Seems you're right, it's about docker caching.... But how?!? Before reporting this issue, I've done following steps for clearing up the system's cache:
docker system prune -a
to clear everything, which is not useddocker-compose pull
to get latest imagesdocker-compose build --no-cache
-> build still not working
Seems working fine again after adding --pull
(may also --force-rm
on first run, just to be sure... XD). So the full command looks something like docker-compose build --no-cache --pull --force-rm
.
Thx for the awesome support! I'll close this issue :-)
Seems since latest caddy:2.6 version there's no support for github/url subfolders / paths anymore. I'm building an own caddy binary with following Dockerfile:
This worked some weeks before (think already with v2.6), but since latest build I need to change
caddy:2-builder-alpine
toe.g. caddy:2.5.2-builder-alpine
. Are there any syntax changes or removal of a feature? :-)Kindest regards