Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit a22d176

Browse files
authored
undo Dockerfile changes, keep cred helpers for now
1 parent ef44645 commit a22d176

4 files changed

Lines changed: 84 additions & 18 deletions

File tree

deploy/Dockerfile

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,28 @@
1313
# limitations under the License.
1414

1515
FROM golang:1.17
16+
WORKDIR /src
1617

1718
# This arg is passed by docker buildx & contains the target CPU architecture (e.g., amd64, arm64, etc.)
1819
ARG TARGETARCH
1920

20-
WORKDIR /src
21-
COPY . .
21+
ENV GOARCH=$TARGETARCH
22+
ENV CGO_ENABLED=0
23+
ENV GOBIN=/usr/local/bin
24+
25+
# Get GCR credential helper
26+
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
27+
28+
# Get Amazon ECR credential helper
29+
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
2230

31+
# Get ACR docker env credential helper
32+
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
33+
34+
# Add .docker config dir
35+
RUN mkdir -p /kaniko/.docker
36+
37+
COPY . .
2338
RUN \
2439
--mount=type=cache,target=/root/.cache/go-build \
2540
--mount=type=cache,target=/go/pkg \
@@ -36,11 +51,18 @@ RUN \
3651

3752
FROM scratch
3853
COPY --from=0 /src/out/executor /kaniko/executor
39-
COPY files/nsswitch.conf /etc/nsswitch.conf
54+
COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr
55+
COPY --from=0 /usr/local/bin/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
56+
COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env
4057
COPY --from=certs /ca-certificates.crt /kaniko/ssl/certs/
58+
COPY --from=0 /kaniko/.docker /kaniko/.docker
59+
COPY files/nsswitch.conf /etc/nsswitch.conf
4160
ENV HOME /root
4261
ENV USER root
4362
ENV PATH /usr/local/bin:/kaniko
4463
ENV SSL_CERT_DIR=/kaniko/ssl/certs
64+
ENV DOCKER_CONFIG /kaniko/.docker/
65+
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
66+
WORKDIR /workspace
4567

4668
ENTRYPOINT ["/kaniko/executor"]

deploy/Dockerfile_debug

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,28 @@
1313
# limitations under the License.
1414

1515
FROM golang:1.17
16+
WORKDIR /src
1617

1718
# This arg is passed by docker buildx & contains the target CPU architecture (e.g., amd64, arm64, etc.)
1819
ARG TARGETARCH
1920

20-
WORKDIR /src
21-
COPY . .
21+
ENV GOARCH=$TARGETARCH
22+
ENV CGO_ENABLED=0
23+
ENV GOBIN=/usr/local/bin
24+
25+
# Get GCR credential helper
26+
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
27+
28+
# Get Amazon ECR credential helper
29+
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
30+
31+
# Get ACR docker env credential helper
32+
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
2233

34+
# Add .docker config dir
35+
RUN mkdir -p /kaniko/.docker
36+
37+
COPY . .
2338
RUN \
2439
--mount=type=cache,target=/root/.cache/go-build \
2540
--mount=type=cache,target=/go/pkg \
@@ -38,13 +53,9 @@ RUN \
3853
FROM scratch
3954
COPY --from=0 /src/out/executor /kaniko/executor
4055
COPY --from=0 /src/out/warmer /kaniko/warmer
41-
COPY files/nsswitch.conf /etc/nsswitch.conf
42-
COPY --from=certs /ca-certificates.crt /kaniko/ssl/certs/
43-
ENV HOME /root
44-
ENV USER root
45-
ENV PATH /usr/local/bin:/kaniko
46-
ENV SSL_CERT_DIR=/kaniko/ssl/certs
47-
56+
COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr
57+
COPY --from=0 /usr/local/bin/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
58+
COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env
4859
COPY --from=busybox:1.32.0 /bin /busybox
4960
# Since busybox needs some lib files which lie in /lib directory to run the executables on s390x,
5061
# the below COPY command is added to address "ld64.so.1 not found" issue. This extra copy action will not
@@ -53,7 +64,17 @@ COPY --from=busybox:1.32.0 /bin /busybox
5364
COPY --from=busybox:1.32.0 /*lib /lib
5465
# Declare /busybox as a volume to get it automatically in the path to ignore
5566
VOLUME /busybox
67+
68+
COPY --from=certs /ca-certificates.crt /kaniko/ssl/certs/
69+
COPY --from=0 /kaniko/.docker /kaniko/.docker
70+
COPY files/nsswitch.conf /etc/nsswitch.conf
71+
ENV HOME /root
72+
ENV USER root
73+
ENV PATH /usr/local/bin:/kaniko:/busybox
74+
ENV SSL_CERT_DIR=/kaniko/ssl/certs
75+
ENV DOCKER_CONFIG /kaniko/.docker/
76+
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
77+
WORKDIR /workspace
5678
RUN ["/busybox/mkdir", "-p", "/bin"]
5779
RUN ["/busybox/ln", "-s", "/busybox/sh", "/bin/sh"]
58-
5980
ENTRYPOINT ["/kaniko/executor"]

deploy/Dockerfile_slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# Builds the static Go image to execute in a Kubernetes job
1516
FROM golang:1.17
1617

1718
# This arg is passed by docker buildx & contains the target CPU architecture (e.g., amd64, arm64, etc.)
@@ -44,3 +45,4 @@ ENV PATH /usr/local/bin:/kaniko
4445
ENV SSL_CERT_DIR=/kaniko/ssl/certs
4546

4647
ENTRYPOINT ["/kaniko/executor"]
48+

deploy/Dockerfile_warmer

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,28 @@
1313
# limitations under the License.
1414

1515
FROM golang:1.17
16+
WORKDIR /src
1617

1718
# This arg is passed by docker buildx & contains the target CPU architecture (e.g., amd64, arm64, etc.)
1819
ARG TARGETARCH
1920

20-
WORKDIR /src
21-
COPY . .
21+
ENV GOARCH=$TARGETARCH
22+
ENV CGO_ENABLED=0
23+
ENV GOBIN=/usr/local/bin
24+
25+
# Get GCR credential helper
26+
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
27+
28+
# Get Amazon ECR credential helper
29+
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
30+
31+
# Get ACR docker env credential helper
32+
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
2233

34+
# Add .docker config dir
35+
RUN mkdir -p /kaniko/.docker
36+
37+
COPY . .
2338
RUN \
2439
--mount=type=cache,target=/root/.cache/go-build \
2540
--mount=type=cache,target=/go/pkg \
@@ -36,11 +51,17 @@ RUN \
3651

3752
FROM scratch
3853
COPY --from=0 /src/out/warmer /kaniko/warmer
39-
COPY files/nsswitch.conf /etc/nsswitch.conf
54+
COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr
55+
COPY --from=0 /usr/local/bin/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
56+
COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env
4057
COPY --from=certs /ca-certificates.crt /kaniko/ssl/certs/
58+
COPY --from=0 /kaniko/.docker /kaniko/.docker
59+
COPY files/nsswitch.conf /etc/nsswitch.conf
4160
ENV HOME /root
42-
ENV USER root
61+
ENV USER /root
4362
ENV PATH /usr/local/bin:/kaniko
4463
ENV SSL_CERT_DIR=/kaniko/ssl/certs
45-
64+
ENV DOCKER_CONFIG /kaniko/.docker/
65+
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
66+
WORKDIR /workspace
4667
ENTRYPOINT ["/kaniko/warmer"]

0 commit comments

Comments
 (0)