This commit is contained in:
Lukas Eipert 2022-02-21 18:02:01 +01:00
parent 9337cd93fa
commit c45c6ca23f
4 changed files with 45 additions and 20 deletions

View file

@ -1,11 +1,6 @@
FROM gcr.io/kaniko-project/executor:v1.7.0-debug AS kaniko-src
# kaniko cannot place files under /kaniko, therefore we move
# the kaniko folder to /kaniko-dist
# https://github.com/GoogleContainerTools/kaniko/issues/960#issuecomment-573160390
RUN cp -r /kaniko /kaniko-dist
FROM gcr.io/go-containerregistry/crane as crane
FROM gcr.io/go-containerregistry/crane as crane-src
FROM alpine/git
@ -13,21 +8,21 @@ ENV HOME /root
ENV USER root
# See https://github.com/GoogleContainerTools/kaniko/blob/master/deploy/Dockerfile#L65-L70
# Modified to use /kaniko-dist however, due to the limitation above
COPY --from=kaniko-src /kaniko-dist/ /kaniko-dist/
# Modified to use /kaniko however, due to the limitation above
COPY --from=kaniko-src /kaniko/ /kaniko/
COPY --from=kaniko-src /etc/nsswitch.conf /etc/nsswitch.conf
ENV PATH /kaniko-dist:$PATH
ENV SSL_CERT_DIR=/kaniko-dist/ssl/certs
ENV DOCKER_CONFIG /kaniko-dist/.docker/
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko-dist/.config/gcloud/docker_credential_gcr_config.json
ENV PATH /kaniko:$PATH
ENV SSL_CERT_DIR=/kaniko/ssl/certs
ENV DOCKER_CONFIG /kaniko/.docker/
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
## add aliases for kaniko-executor and kaniko-warmer for better convenience
RUN ln -s /kaniko-dist/executor /kaniko-dist/kaniko-executor && \
ln -s /kaniko-dist/warmer /kaniko-dist/kaniko-warmer
RUN ln -s /kaniko/executor /kaniko/kaniko-executor && \
ln -s /kaniko/warmer /kaniko/kaniko-warmer
# Adding crane to the image
COPY --from=crane /ko-app/crane /usr/local/bin/crane
COPY --from=crane-src /ko-app/crane /usr/local/bin/crane
# Adding jq to the image
RUN apk add --no-cache jq