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

Can't build container #209

Open
thepatrick opened this issue Jul 15, 2019 · 4 comments

Comments

@thepatrick
Copy link

commented Jul 15, 2019

docker build is failing for me today with the error: go: github.com/mholt/caddy@v1.0.1: parsing go.mod: unexpected module path "github.com/caddyserver/caddy"

Full logs below:

$  docker build -t thepatrick/webserver-caddy --build-arg plugins=cloudflare,route53 github.com/abiosoft/caddy-docker.git                                                   1
Sending build context to Docker daemon  109.1kB
Step 1/24 : FROM abiosoft/caddy:builder as builder
 ---> 5e3f22e6d0be
Step 2/24 : ARG version="1.0.1"
 ---> Running in 2f67cc2ebd63
Removing intermediate container 2f67cc2ebd63
 ---> 7244e5b4163a
Step 3/24 : ARG plugins="git,cors,realip,expires,cache,cloudflare"
 ---> Running in 5b144e79dff0
Removing intermediate container 5b144e79dff0
 ---> dde9d244d51f
Step 4/24 : ARG enable_telemetry="true"
 ---> Running in 2c76d5ef505c
Removing intermediate container 2c76d5ef505c
 ---> 6f2d65df036a
Step 5/24 : RUN go get -v github.com/abiosoft/parent
 ---> Running in cb639dfd59b1
github.com/abiosoft/parent (download)
github.com/abiosoft/parent
Removing intermediate container cb639dfd59b1
 ---> 5e34135da33e
Step 6/24 : RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh
 ---> Running in 6228775928e1

starting stage: fetching caddy source
Cloning into '/go/src/github.com/mholt/caddy'...
Note: checking out 'f6ee100bae9c0de566a2f7ae531113be0a9a0b83'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

Cloning into '/dnsproviders'...
finished stage: fetching caddy source ✓


starting stage: installing plugin helper
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
	ignoring go.mod;
	see 'go help modules'
github.com/abiosoft/caddyplug (download)
github.com/abiosoft/errs (download)
github.com/fatih/color (download)
Fetching https://golang.org/x/sys/unix?go-get=1
Parsing meta tags from https://golang.org/x/sys/unix?go-get=1 (status code 200)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at https://golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
Fetching https://golang.org/x/sys?go-get=1
Parsing meta tags from https://golang.org/x/sys?go-get=1 (status code 200)
golang.org/x/sys (download)
github.com/abiosoft/errs
github.com/fatih/color/vendor/github.com/mattn/go-isatty
golang.org/x/sys/unix
github.com/abiosoft/caddyplug/internal
github.com/fatih/color/vendor/github.com/mattn/go-colorable
github.com/fatih/color
github.com/abiosoft/caddyplug/caddyplug
finished stage: installing plugin helper ✓


starting stage: generating plugins
finished stage: generating plugins ✓


starting stage: customising plugins and telemetry
go: creating new go.mod: module caddy
go: finding github.com/mholt/caddy v1.0.1
go: github.com/mholt/caddy@v1.0.1: parsing go.mod: unexpected module path "github.com/caddyserver/caddy"
go: error loading module requirements
finished stage: customising plugins and telemetry ✓


starting stage: building caddy
go: finding github.com/go-acme/lego/providers/dns/route53 latest
go: finding github.com/go-acme/lego/providers/dns/cloudflare latest
go: finding github.com/mholt/caddy/caddy/caddymain latest
go: finding github.com/caddyserver/caddy/caddytls latest
go: finding github.com/mholt/caddy/caddy latest
go: downloading github.com/mholt/caddy v1.0.1
go: extracting github.com/mholt/caddy v1.0.1
go: finding github.com/caddyserver/caddy v1.0.1
go: finding github.com/go-acme/lego/providers/dns latest
go: finding github.com/go-acme/lego/providers latest
go: downloading github.com/caddyserver/caddy v1.0.1
go: extracting github.com/caddyserver/caddy v1.0.1
go: finding github.com/go-acme/lego v2.6.0+incompatible
go: downloading github.com/go-acme/lego v2.6.0+incompatible
go: extracting github.com/go-acme/lego v2.6.0+incompatible
go: github.com/mholt/caddy@v1.0.1: parsing go.mod: unexpected module path "github.com/caddyserver/caddy"
go: error loading module requirements
error at 'building caddy'
@abiosoft

This comment has been minimized.

Copy link
Owner

commented Jul 16, 2019

Run docker pull abiosoft/caddy:builder and try again.

@philippgille

This comment has been minimized.

Copy link

commented Jul 21, 2019

It's either still or again broken. In my case with a different, but similar error, related to import / module paths.

The image is the newest, see:

$ docker pull abiosoft/caddy:builder

builder: Pulling from abiosoft/caddy
Digest: sha256:81531392fb405b064c95f13cfb59e8340e6380fe0febc73d340ade7b43101b83
Status: Image is up to date for abiosoft/caddy:builder

Then I want to build an image with the proxy plugin:

$ docker build --build-arg plugins=proxy -t local/caddy github.com/abiosoft/caddy-docker.git

[...]
github.com/miekg/dns
github.com/go-acme/lego/challenge/dns01
github.com/go-acme/lego/challenge/resolver
github.com/go-acme/lego/lego
github.com/mholt/certmagic
github.com/caddyserver/caddy
package caddy:
proxy.go:2:10: invalid import path: ""
finished stage: customising plugins and telemetry ✓


starting stage: building caddy
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/gorilla/websocket v1.4.0
[...]
go: extracting gopkg.in/natefinch/lumberjack.v2 v2.0.0
can't load package: package caddy:
proxy.go:2:10: invalid import path: ""
error at 'building caddy'
The command '/bin/sh -c VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh' returned a non-zero code: 1
@philippgille

This comment has been minimized.

Copy link

commented Jul 21, 2019

Ah my bad I think. proxy is an invalid plugin name if I'm not mistaken, as it's already part of Caddy.

Building with an empty plugin list plugins="" works fine.

Maybe the error message can be improved. For exmple when building with plugins=foo, there should be an early check if foo is a valid plugin at all and then the build should exit with an appropriate error and a clear message to the user. foo.go:2:10: invalid import path: "" instead looks like some error in a Go file (well, it probably is and the file is generated during build time, but this makes it hard to understand what the real issue is).

@abiosoft

This comment has been minimized.

Copy link
Owner

commented Jul 21, 2019

@philippgille yeah, the message can be better. You can open a separate issue to address that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.