Skip to content

Commit f17a9c1

Browse files
fix: use appropriate builder images for docker credential helpers
The credential helpers both use CGO, which is forced by a dependency. This change ensures the dynamically linked results are appropriate for the target images.
1 parent e496542 commit f17a9c1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Dockerfile

Lines changed: 2 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" && \

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)