latest and greatest symlink

This commit is contained in:
Lukas Eipert 2022-02-21 17:09:35 +01:00
parent 510573206c
commit 9811251865
2 changed files with 10 additions and 5 deletions

View file

@ -1,6 +1,7 @@
FROM gcr.io/kaniko-project/executor:v1.7.0-debug AS kaniko-src
# Issue with kaniko which cannot copy files called kaniko:
# 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
@ -12,6 +13,7 @@ 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/
COPY --from=kaniko-src /etc/nsswitch.conf /etc/nsswitch.conf
@ -20,10 +22,9 @@ 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
## add symlinks for kaniko
## 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 && \
ln -s /kaniko-dist /kaniko
ln -s /kaniko-dist/warmer /kaniko-dist/kaniko-warmer
# Adding crane to the image
COPY --from=crane /ko-app/crane /usr/local/bin/crane

View file

@ -1,10 +1,14 @@
#!/bin/sh
# Force a symlink to circumvent:
# https://github.com/GoogleContainerTools/kaniko/issues/960#issuecomment-573160390
ln -sf /kaniko /kaniko-dist
if [ -z "$BUILD_IMAGE_NO_MESSAGE" ]; then
echo "You are using a GitLab CI build-image with kaniko and crane"
echo "You can suppress this message by setting BUILD_IMAGE_NO_MESSAGE"
kaniko-executor version
/kaniko/executor version
echo "Crane version: $(crane version)"
fi