Skip to content

Commit 1f0d740

Browse files
Merge pull request #1561 from snyk/fix/docker-credential-helpers-builder-images
[OI-670] fix: use appropriate builder images for docker credential helpers
2 parents e496542 + d867a62 commit 1f0d740

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#---------------------------------------------------------------------
22
# STAGE 1: Build credential helpers inside a temporary container
33
#---------------------------------------------------------------------
4-
FROM --platform=linux/amd64 golang:1.23 AS cred-helpers-build
4+
FROM --platform=linux/amd64 golang:1.23-alpine AS cred-helpers-build
55

6+
RUN apk add git
67
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@bef5bd9384b752e5c645659165746d5af23a098a
78
RUN --mount=type=secret,id=gh_token,required=true \
89
git config --global url."https://$(cat /run/secrets/gh_token):[email protected]/snyk".insteadOf "https://github.com/snyk" && \
@@ -29,6 +30,8 @@ RUN apk update
2930
RUN apk upgrade
3031
RUN apk --no-cache add dumb-init skopeo curl bash python3
3132

33+
RUN npm install -g [email protected]
34+
3235
RUN addgroup -S -g 10001 snyk
3336
RUN adduser -S -G snyk -h /srv/app -u 10001 snyk
3437

Dockerfile.ubi9

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#---------------------------------------------------------------------
22
# STAGE 1: Build credential helpers inside a temporary container
33
#---------------------------------------------------------------------
4-
FROM --platform=linux/amd64 golang:1.23 as cred-helpers-build
4+
FROM --platform=linux/amd64 registry.access.redhat.com/ubi9/go-toolset:9.5 as cred-helpers-build
55

6-
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@bef5bd9384b752e5c645659165746d5af23a098a
7-
RUN --mount=type=secret,id=gh_token,required=true \
6+
RUN GOTOOLCHAIN=go1.23.4 go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@bef5bd9384b752e5c645659165746d5af23a098a
7+
RUN --mount=type=secret,id=gh_token,uid=1001,required=true \
88
git config --global url."https://$(cat /run/secrets/gh_token):[email protected]/snyk".insteadOf "https://github.com/snyk" && \
99
go env -w GOPRIVATE=github.com/snyk && \
10-
go install github.com/snyk/docker-credential-acr-env@8fa416c5b20b174e9032df1899843b4ebe2adda8 && \
10+
GOTOOLCHAIN=go1.23.4 go install github.com/snyk/docker-credential-acr-env@8fa416c5b20b174e9032df1899843b4ebe2adda8 && \
1111
git config --global --unset url."https://$(cat /run/secrets/gh_token):[email protected]/snyk".insteadOf
1212

1313
#---------------------------------------------------------------------
@@ -80,8 +80,8 @@ COPY --chown=snyk:snyk --from=containers-common /etc/containers/registries.d/def
8080
COPY --chown=snyk:snyk --from=containers-common /etc/containers/policy.json /etc/containers/policy.json
8181

8282
# Install credential helpers
83-
COPY --chown=snyk:snyk --from=cred-helpers-build /go/bin/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login
84-
COPY --chown=snyk:snyk --from=cred-helpers-build /go/bin/docker-credential-acr-env /usr/local/bin/docker-credential-acr-env
83+
COPY --chown=snyk:snyk --from=cred-helpers-build /opt/app-root/src/go/bin/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login
84+
COPY --chown=snyk:snyk --from=cred-helpers-build /opt/app-root/src/go/bin/docker-credential-acr-env /usr/bin/docker-credential-acr-env
8585

8686
# Install gcloud
8787
RUN curl -sSfL https://sdk.cloud.google.com | bash -s -- --disable-prompts --install-dir=/ && \

0 commit comments

Comments
 (0)