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

Use golang:1.15 in ECR credential helper example #965

Merged
merged 2 commits into from
Aug 13, 2021

Conversation

jerbob
Copy link
Contributor

@jerbob jerbob commented May 21, 2021

The example Dockerfile provided for ecr-credential-helper no longer builds on golang:1.16.

This PR simply pins the version specified in the Dockerfile to golang:1.15:

$ cat Dockerfile
FROM golang:latest

ENV CGO_ENABLED 0
ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

RUN go get -u $REPO

RUN rm /go/bin/docker-credential-ecr-login

RUN go build \
 -o /go/bin/docker-credential-ecr-login \
 /go/src/$REPO

WORKDIR /go/bin/
ubuntu@ip-10-0-3-95:~/credential-helper$ docker build -t aws-ecr-dock-cred-helper .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM golang:latest
 ---> 96129f3766cf
Step 2/7 : ENV CGO_ENABLED 0
 ---> Using cache
 ---> 905ba7abe5da
Step 3/7 : ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
 ---> Using cache
 ---> 7812b2c262c2
Step 4/7 : RUN go get -u $REPO
 ---> Using cache
 ---> d598e79b0d71
Step 5/7 : RUN rm /go/bin/docker-credential-ecr-login
 ---> Using cache
 ---> 0cbf53304a18
Step 6/7 : RUN go build  -o /go/bin/docker-credential-ecr-login  /go/src/$REPO
 ---> Running in 2dad4197b560
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
The command '/bin/sh -c go build  -o /go/bin/docker-credential-ecr-login  /go/src/$REPO' returned a non-zero
code: 1
$ cat Dockerfile
FROM golang:1.15

ENV CGO_ENABLED 0
ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

RUN go get -u $REPO

RUN rm /go/bin/docker-credential-ecr-login

RUN go build \
 -o /go/bin/docker-credential-ecr-login \
 /go/src/$REPO

WORKDIR /go/bin/
$ docker build -t aws-ecr-dock-cred-helper .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM golang:1.15
 ---> e5b4455acc93
Step 2/7 : ENV CGO_ENABLED 0
 ---> Using cache
 ---> 32df66289405
Step 3/7 : ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
 ---> Using cache
 ---> 3ff787805cb3
Step 4/7 : RUN go get -u $REPO
 ---> Using cache
 ---> 7117a30722f5
Step 5/7 : RUN rm /go/bin/docker-credential-ecr-login
 ---> Using cache
 ---> 2780ccb85ab8
Step 6/7 : RUN go build  -o /go/bin/docker-credential-ecr-login  /go/src/$REPO
 ---> Using cache
 ---> f848f437fa25
Step 7/7 : WORKDIR /go/bin/
 ---> Using cache
 ---> 58cd6fc9e9f1
Successfully built 58cd6fc9e9f1
Successfully tagged aws-ecr-dock-cred-helper:latest

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #965 (8536597) into main (61b715a) will increase coverage by 5.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #965      +/-   ##
==========================================
+ Coverage   54.47%   59.63%   +5.15%     
==========================================
  Files          25       22       -3     
  Lines        1452     1412      -40     
==========================================
+ Hits          791      842      +51     
+ Misses        594      500      -94     
- Partials       67       70       +3     
Impacted Files Coverage Δ
pkg/container/container.go 45.36% <0.00%> (-1.96%) ⬇️
pkg/notifications/msteams.go 66.66% <0.00%> (-1.76%) ⬇️
pkg/notifications/gotify.go 66.66% <0.00%> (-1.08%) ⬇️
pkg/container/client.go 14.28% <0.00%> (-0.31%) ⬇️
pkg/notifications/email.go 90.69% <0.00%> (-0.22%) ⬇️
pkg/notifications/slack.go 100.00% <0.00%> (ø)
pkg/container/util.go
pkg/notifications/util.go
pkg/notifications/smtp.go
internal/flags/flags.go 88.65% <0.00%> (+0.17%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61b715a...8536597. Read the comment docs.

Copy link
Member

@simskij simskij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be a more suitable solution. What do you think? It would allow us to not depend on an old version of go.

docs/private-registries.md Outdated Show resolved Hide resolved
Co-authored-by: Simon Aronsson <simme@arcticbit.se>
@jerbob jerbob requested a review from simskij June 30, 2021 13:30
@simskij simskij merged commit bd74c05 into containrrr:main Aug 13, 2021
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

4 participants