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

Fix docker image build #336

Closed
wants to merge 10 commits into from
Closed

Conversation

rbarabas
Copy link

Fixes docker image build issue

The image fails to build due to a go oauth2 package dependency issue outlined in aws-observability/aws-otel-collector#926.

During build you would encounter the following error:

2023-02-14T20:29:04Z #16 [build 6/7] COPY . /go/src/github.com/netlify/gotrue
2023-02-14T20:29:04Z #16 DONE 0.1s
2023-02-14T20:29:04Z
2023-02-14T20:29:04Z #17 [build 7/7] RUN make build
2023-02-14T20:29:04Z #17 0.419 go build -ldflags "-X github.com/netlify/gotrue/cmd.Version=`git rev-parse HEAD`"
2023-02-14T20:29:06Z #17 1.776 /go/pkg/mod/golang.org/x/oauth2@v0.0.0-20220524215830-622c5d57e401/google/default.go:17:2: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules:
2023-02-14T20:29:06Z #17 1.776 cloud.google.com/go/compute v1.6.1 (/go/pkg/mod/cloud.google.com/go/compute@v1.6.1/metadata)
2023-02-14T20:29:06Z #17 1.776 cloud.google.com/go/compute/metadata v0.2.0 (/go/pkg/mod/cloud.google.com/go/compute/metadata@v0.2.0)
2023-02-14T20:29:06Z #17 1.778 make: *** [Makefile:13: build] Error 1
2023-02-14T20:29:06Z #17 ERROR: executor failed running [/bin/sh -c make build]: exit code: 2
2023-02-14T20:29:06Z
2023-02-14T20:29:06Z #10 [build 1/7] FROM docker.io/library/golang:1.15-alpine@sha256:b58c367d52e46cdedc25ec9cd74cadb14ad65e8db75b25e5ec117cdb227aa264
2023-02-14T20:29:06Z ------
2023-02-14T20:29:06Z > [build 7/7] RUN make build:
2023-02-14T20:29:06Z #17 0.419 go build -ldflags "-X github.com/netlify/gotrue/cmd.Version=`git rev-parse HEAD`"
2023-02-14T20:29:06Z #17 1.776 /go/pkg/mod/golang.org/x/oauth2@v0.0.0-20220524215830-622c5d57e401/google/default.go:17:2: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules:
2023-02-14T20:29:06Z #17 1.776 cloud.google.com/go/compute v1.6.1 (/go/pkg/mod/cloud.google.com/go/compute@v1.6.1/metadata)
2023-02-14T20:29:06Z #17 1.776 cloud.google.com/go/compute/metadata v0.2.0 (/go/pkg/mod/cloud.google.com/go/compute/metadata@v0.2.0)
2023-02-14T20:29:06Z #17 1.778 make: *** [Makefile:13: build] Error 1
2023-02-14T20:29:06Z ------
2023-02-14T20:29:06Z ERROR: failed to solve: executor failed running [/bin/sh -c make build]: exit code: 2
2023-02-14T20:29:06Z Build failed using Buildkit (1)

In order to solve this I had to execute the following command to update the problematic dependency:

$ go get cloud.google.com/go/compute/metadata && go mod tidy

Updates the go module files to fix a dependency problem

@rbarabas rbarabas closed this Feb 14, 2023
@rbarabas rbarabas changed the title Rb/mod tidy Fix docker image build Feb 14, 2023
@rbarabas
Copy link
Author

Apologies, submitted to the wrong repository!

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 this pull request may close these issues.

None yet

3 participants