dunglas/mercure

Building caddy with mercure module fails with "crypto/ecdh: package crypto/ecdh is not in GOROOT"

aburg opened this issue · 1 comments

aburg commented

Using this 'Dockerfile':

FROM caddy:2.6-builder AS builder

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

FROM caddy:2.6

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

The build fails with "crypto/ecdh: package crypto/ecdh is not in GOROOT":

❯ docker build .
[+] Building 84.6s (7/8)                                                                                                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                                                                                           0.0s
 => => transferring dockerfile: 204B                                                                                                                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/caddy:2.6                                                                                                                                                                                   0.8s
 => [internal] load metadata for docker.io/library/caddy:2.6-builder                                                                                                                                                                           0.8s
 => CACHED [builder 1/2] FROM docker.io/library/caddy:2.6-builder@sha256:5d25acee5683b45e637dff3a8799b8ae6ca58f33fdb1c89db14dd0840c318bd1                                                                                                      0.0s
 => => resolve docker.io/library/caddy:2.6-builder@sha256:5d25acee5683b45e637dff3a8799b8ae6ca58f33fdb1c89db14dd0840c318bd1                                                                                                                     0.0s
 => [stage-1 1/2] FROM docker.io/library/caddy:2.6@sha256:ef6ed6e22b469efd5051e1c4cee221d3a0ebebea14bbb5898c8fb4dc70d12d12                                                                                                                     0.0s
 => => resolve docker.io/library/caddy:2.6@sha256:ef6ed6e22b469efd5051e1c4cee221d3a0ebebea14bbb5898c8fb4dc70d12d12                                                                                                                             0.0s
 => ERROR [builder 2/2] RUN xcaddy build     --with github.com/dunglas/mercure/caddy                                                                                                                                                          83.6s
------                                                                                                                                                                                                                                              
 > [builder 2/2] RUN xcaddy build     --with github.com/dunglas/mercure/caddy:                                                                                                                                                                      
#0 0.197 2023/05/31 09:27:12 [INFO] Temporary folder: /tmp/buildenv_2023-05-31-0927.212042483                                                                                                                                                       
#0 0.197 2023/05/31 09:27:12 [INFO] Writing main module: /tmp/buildenv_2023-05-31-0927.212042483/main.go                                                                                                                                            
#0 0.197 package main                                                                                                                                                                                                                               
#0 0.197                                                                                                                                                                                                                                            
#0 0.197 import (
#0 0.197        caddycmd "github.com/caddyserver/caddy/v2/cmd"
#0 0.197 
#0 0.197        // plug in Caddy modules here
#0 0.197        _ "github.com/caddyserver/caddy/v2/modules/standard"
#0 0.197        _ "github.com/dunglas/mercure/caddy"
#0 0.197 )
#0 0.197 
#0 0.197 func main() {
#0 0.197        caddycmd.Main()
#0 0.197 }
#0 0.197 2023/05/31 09:27:12 [INFO] Initializing Go module
#0 0.197 2023/05/31 09:27:12 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go mod init caddy 
#0 0.200 go: creating new go.mod: module caddy
#0 0.200 go: to add module requirements and sums:
#0 0.200        go mod tidy
#0 0.201 2023/05/31 09:27:12 [INFO] Pinning versions
#0 0.201 2023/05/31 09:27:12 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.6.4 
#0 0.327 go: downloading github.com/caddyserver/caddy/v2 v2.6.4
#0 0.721 go: downloading github.com/prometheus/client_golang v1.14.0
#0 0.722 go: downloading github.com/caddyserver/certmagic v0.17.2
#0 0.722 go: downloading github.com/google/uuid v1.3.0
#0 0.722 go: downloading github.com/quic-go/quic-go v0.32.0
#0 0.723 go: downloading go.uber.org/zap v1.24.0
#0 0.725 go: downloading golang.org/x/sys v0.5.0
#0 0.725 go: downloading golang.org/x/term v0.5.0
#0 0.894 go: downloading github.com/prometheus/common v0.37.0
#0 0.894 go: downloading github.com/prometheus/procfs v0.8.0
#0 0.894 go: downloading github.com/beorn7/perks v1.0.1
#0 0.894 go: downloading github.com/golang/protobuf v1.5.2
#0 0.894 go: downloading github.com/prometheus/client_model v0.3.0
#0 0.895 go: downloading github.com/cespare/xxhash/v2 v2.1.2
#0 0.909 go: downloading google.golang.org/protobuf v1.28.1
#0 0.923 go: downloading github.com/klauspost/cpuid/v2 v2.2.3
#0 1.029 go: downloading github.com/libdns/libdns v0.2.1
#0 1.029 go: downloading github.com/mholt/acmez v1.1.0
#0 1.145 go: downloading github.com/miekg/dns v1.1.50
#0 1.416 go: downloading golang.org/x/crypto v0.5.0
#0 1.464 go: downloading golang.org/x/net v0.7.0
#0 1.477 go: downloading github.com/cespare/xxhash v1.1.0
#0 1.528 go: downloading go.uber.org/atomic v1.9.0
#0 1.528 go: downloading go.uber.org/multierr v1.6.0
#0 1.533 go: downloading github.com/golang/mock v1.6.0
#0 1.533 go: downloading github.com/onsi/ginkgo/v2 v2.2.0
#0 1.575 go: downloading github.com/quic-go/qpack v0.4.0
#0 1.908 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
#0 2.008 go: downloading golang.org/x/exp v0.0.0-20221205204356-47842c84f3db
#0 2.051 go: downloading github.com/quic-go/qtls-go1-18 v0.2.0
#0 2.499 go: downloading github.com/quic-go/qtls-go1-19 v0.2.0
#0 2.563 go: downloading github.com/quic-go/qtls-go1-20 v0.1.0
#0 2.716 go: downloading golang.org/x/tools v0.2.0
#0 2.777 go: downloading golang.org/x/mod v0.6.0
#0 2.778 go: downloading golang.org/x/text v0.7.0
#0 3.100 go: downloading github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38
#0 3.100 go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
#0 12.00 go: added github.com/beorn7/perks v1.0.1
#0 12.00 go: added github.com/caddyserver/caddy/v2 v2.6.4
#0 12.00 go: added github.com/caddyserver/certmagic v0.17.2
#0 12.00 go: added github.com/cespare/xxhash/v2 v2.1.2
#0 12.00 go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
#0 12.00 go: added github.com/golang/mock v1.6.0
#0 12.00 go: added github.com/golang/protobuf v1.5.2
#0 12.00 go: added github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38
#0 12.00 go: added github.com/google/uuid v1.3.0
#0 12.00 go: added github.com/klauspost/cpuid/v2 v2.2.3
#0 12.00 go: added github.com/libdns/libdns v0.2.1
#0 12.00 go: added github.com/matttproud/golang_protobuf_extensions v1.0.1
#0 12.00 go: added github.com/mholt/acmez v1.1.0
#0 12.00 go: added github.com/miekg/dns v1.1.50
#0 12.00 go: added github.com/onsi/ginkgo/v2 v2.2.0
#0 12.00 go: added github.com/prometheus/client_golang v1.14.0
#0 12.00 go: added github.com/prometheus/client_model v0.3.0
#0 12.00 go: added github.com/prometheus/common v0.37.0
#0 12.00 go: added github.com/prometheus/procfs v0.8.0
#0 12.00 go: added github.com/quic-go/qpack v0.4.0
#0 12.00 go: added github.com/quic-go/qtls-go1-18 v0.2.0
#0 12.00 go: added github.com/quic-go/qtls-go1-19 v0.2.0
#0 12.00 go: added github.com/quic-go/qtls-go1-20 v0.1.0
#0 12.00 go: added github.com/quic-go/quic-go v0.32.0
#0 12.00 go: added go.uber.org/atomic v1.9.0
#0 12.00 go: added go.uber.org/multierr v1.6.0
#0 12.00 go: added go.uber.org/zap v1.24.0
#0 12.00 go: added golang.org/x/crypto v0.5.0
#0 12.00 go: added golang.org/x/exp v0.0.0-20221205204356-47842c84f3db
#0 12.00 go: added golang.org/x/mod v0.6.0
#0 12.00 go: added golang.org/x/net v0.7.0
#0 12.00 go: added golang.org/x/sys v0.5.0
#0 12.00 go: added golang.org/x/term v0.5.0
#0 12.00 go: added golang.org/x/text v0.7.0
#0 12.00 go: added golang.org/x/tools v0.2.0
#0 12.00 go: added google.golang.org/protobuf v1.28.1
#0 12.00 2023/05/31 09:27:24 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v github.com/dunglas/mercure/caddy github.com/caddyserver/caddy/v2@v2.6.4 
#0 12.29 go: downloading github.com/dunglas/mercure v0.14.9
#0 12.30 go: downloading github.com/dunglas/mercure/caddy v0.14.9
#0 13.80 go: downloading github.com/prometheus/client_golang v1.15.1
#0 13.80 go: downloading github.com/quic-go/quic-go v0.34.0
#0 13.80 go: downloading golang.org/x/sys v0.8.0
#0 13.80 go: downloading golang.org/x/term v0.8.0
#0 13.80 go: downloading github.com/google/cel-go v0.15.3
#0 14.00 go: downloading golang.org/x/net v0.10.0
#0 14.14 go: downloading google.golang.org/genproto v0.0.0-20230524185152-1884fd1fac28
#0 14.14 go: downloading github.com/dustin/go-humanize v1.0.1
#0 14.49 go: downloading github.com/mholt/acmez v1.1.1
#0 14.49 go: downloading github.com/klauspost/cpuid/v2 v2.2.4
#0 14.49 go: downloading github.com/miekg/dns v1.1.54
#0 14.49 go: downloading golang.org/x/crypto v0.9.0
#0 14.49 go: downloading github.com/dgraph-io/ristretto v0.1.1
#0 14.49 go: downloading github.com/gofrs/uuid v4.4.0+incompatible
#0 14.49 go: downloading github.com/golang-jwt/jwt/v4 v4.5.0
#0 14.49 go: downloading github.com/gorilla/handlers v1.5.1
#0 14.50 go: downloading github.com/gorilla/mux v1.8.0
#0 14.50 go: downloading github.com/hashicorp/golang-lru v0.5.4
#0 14.63 go: downloading github.com/kevburnsjr/skipfilter v0.0.1
#0 14.78 go: downloading github.com/spf13/pflag v1.0.5
#0 14.78 go: downloading github.com/spf13/viper v1.15.0
#0 14.78 go: downloading github.com/unrolled/secure v1.13.0
#0 15.51 go: downloading github.com/yosida95/uritemplate/v3 v3.0.2
#0 15.55 go: downloading go.etcd.io/bbolt v1.3.7
#0 15.57 go: downloading go.uber.org/atomic v1.11.0
#0 15.59 go: downloading go.uber.org/multierr v1.11.0
#0 15.62 go: downloading github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
#0 15.62 go: downloading github.com/spf13/cobra v1.7.0
#0 15.69 go: downloading github.com/smallstep/certificates v0.24.2
#0 15.71 go: downloading github.com/tailscale/tscert v0.0.0-20230509043813-4e9cb4f2b4ad
#0 15.74 go: downloading github.com/cespare/xxhash/v2 v2.2.0
#0 16.01 go: downloading github.com/prometheus/client_model v0.4.0
#0 16.01 go: downloading github.com/prometheus/common v0.44.0
#0 16.11 go: downloading github.com/prometheus/procfs v0.10.0
#0 16.13 go: downloading google.golang.org/protobuf v1.30.0
#0 16.61 go: downloading github.com/onsi/ginkgo/v2 v2.9.5
#0 16.67 go: downloading github.com/smallstep/truststore v0.12.1
#0 16.67 go: downloading go.step.sm/crypto v0.30.0
#0 17.07 go: downloading golang.org/x/text v0.9.0
#0 17.07 go: downloading github.com/stoewer/go-strcase v1.3.0
#0 17.47 go: downloading github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df
#0 17.47 go: downloading github.com/felixge/httpsnoop v1.0.3
#0 17.47 go: downloading golang.org/x/tools v0.9.1
#0 17.47 go: downloading github.com/MauriceGit/skiplist v0.0.0-20211105230623-77f5c8d3e145
#0 17.47 go: downloading github.com/RoaringBitmap/roaring v1.3.0
#0 17.47 go: downloading github.com/fsnotify/fsnotify v1.6.0
#0 17.63 go: downloading github.com/mitchellh/mapstructure v1.5.0
#0 17.64 go: downloading github.com/spf13/afero v1.9.5
#0 17.67 go: downloading github.com/spf13/cast v1.5.1
#0 17.67 go: downloading github.com/spf13/jwalterweatherman v1.1.0
#0 18.29 go: downloading golang.org/x/mod v0.10.0
#0 18.35 go: downloading github.com/antlr/antlr4/runtime/Go/antlr v1.4.10
#0 18.46 go: downloading golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
#0 18.66 go: downloading github.com/quic-go/qtls-go1-19 v0.3.2
#0 18.68 go: downloading github.com/quic-go/qtls-go1-20 v0.2.2
#0 18.69 go: downloading github.com/inconshreveable/mousetrap v1.1.0
#0 18.71 go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
#0 19.43 go: downloading gopkg.in/yaml.v3 v3.0.1
#0 19.43 go: downloading github.com/pkg/errors v0.9.1
#0 21.08 go: downloading github.com/slackhq/nebula v1.7.1
#0 21.23 go: downloading go.step.sm/linkedca v0.19.1
#0 21.81 go: downloading github.com/smallstep/nosql v0.6.0
#0 22.09 go: downloading go.step.sm/cli-utils v0.7.6
#0 22.20 go: downloading google.golang.org/grpc v1.55.0
#0 22.20 go: downloading gopkg.in/square/go-jose.v2 v2.6.0
#0 22.20 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
#0 22.20 go: downloading howett.net/plist v1.0.0
#0 22.41 go: downloading github.com/golang/glog v1.1.1
#0 22.41 go: downloading github.com/subosito/gotenv v1.4.2
#0 23.28 go: downloading github.com/hashicorp/hcl v1.0.0
#0 23.56 go: downloading gopkg.in/ini.v1 v1.67.0
#0 24.00 go: downloading github.com/magiconair/properties v1.8.7
#0 24.00 go: downloading github.com/pelletier/go-toml/v2 v2.0.8
#0 24.03 go: downloading github.com/Microsoft/go-winio v0.6.1
#0 24.08 go: downloading github.com/mitchellh/go-ps v1.0.0
#0 24.08 go: downloading github.com/Masterminds/sprig/v3 v3.2.3
#0 24.17 go: downloading filippo.io/edwards25519 v1.0.0
#0 24.36 go: downloading github.com/micromdm/scep/v2 v2.1.0
#0 24.53 go: downloading go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352
#0 24.56 go: downloading github.com/russross/blackfriday/v2 v2.1.0
#0 24.56 go: downloading github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
#0 25.10 go: downloading github.com/urfave/cli v1.22.13
#0 25.15 go: downloading github.com/chzyer/readline v1.5.1
#0 25.15 go: downloading github.com/manifoldco/promptui v0.9.0
#0 25.15 go: downloading github.com/golang/protobuf v1.5.3
#0 25.15 go: downloading github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3
#0 25.17 go: downloading github.com/dgraph-io/badger v1.6.2
#0 25.27 go: downloading github.com/dgraph-io/badger/v2 v2.2007.4
#0 25.55 go: downloading github.com/go-sql-driver/mysql v1.7.1
#0 25.59 go: downloading github.com/jackc/pgx/v4 v4.18.1
#0 25.59 go: downloading github.com/Masterminds/goutils v1.1.1
#0 25.62 go: downloading github.com/Masterminds/semver/v3 v3.2.1
#0 25.72 go: downloading github.com/huandu/xstrings v1.4.0
#0 25.79 go: downloading github.com/imdario/mergo v0.3.15
#0 25.89 go: downloading github.com/mitchellh/copystructure v1.2.0
#0 25.89 go: downloading github.com/shopspring/decimal v1.3.1
#0 25.89 go: downloading github.com/go-kit/kit v0.12.0
#0 26.39 go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
#0 26.40 go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
#0 26.40 go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
#0 26.90 go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96
#0 26.96 go: downloading github.com/golang/snappy v0.0.4
#0 27.01 go: downloading github.com/klauspost/compress v1.16.5
#0 27.05 go: downloading github.com/jackc/pgconn v1.14.0
#0 27.41 go: downloading github.com/jackc/pgio v1.0.0
#0 27.70 go: downloading github.com/jackc/pgproto3/v2 v2.3.2
#0 27.71 go: downloading github.com/jackc/pgtype v1.14.0
#0 27.72 go: downloading github.com/mitchellh/reflectwalk v1.0.2
#0 27.73 go: downloading github.com/mattn/go-colorable v0.1.13
#0 27.82 go: downloading github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a
#0 27.82 go: downloading github.com/jackc/pgpassfile v1.0.0
#0 27.82 go: downloading github.com/jackc/chunkreader/v2 v2.0.1
#0 27.89 go: downloading github.com/go-kit/log v0.2.1
#0 27.90 go: downloading github.com/mattn/go-isatty v0.0.19
#0 28.20 go: downloading github.com/go-logfmt/logfmt v0.6.0
#0 64.41 go: downloading github.com/mschoch/smat v0.2.0
#0 64.41 go: downloading github.com/bits-and-blooms/bitset v1.7.0
#0 83.12 github.com/dunglas/mercure/caddy imports
#0 83.12        github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile imports
#0 83.12        github.com/caddyserver/caddy/v2/modules/caddytls imports
#0 83.12        github.com/smallstep/certificates/authority/provisioner imports
#0 83.12        github.com/slackhq/nebula/cert imports
#0 83.12        crypto/ecdh: package crypto/ecdh is not in GOROOT (/usr/local/go/src/crypto/ecdh)
#0 83.56 2023/05/31 09:28:36 [FATAL] exit status 1
------
Dockerfile:3
--------------------
   2 |     
   3 | >>> RUN xcaddy build \
   4 | >>>     --with github.com/dunglas/mercure/caddy
   5 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c xcaddy build     --with github.com/dunglas/mercure/caddy" did not complete successfully: exit code: 1

Duplicate of #770.