mirror of
https://github.com/aevea/action-kaniko.git
synced 2025-01-30 22:09:37 +01:00
refactor: Use google/go-containerregistry to push image
This commit is contained in:
parent
6030da03d4
commit
5e25ae9c63
2 changed files with 13 additions and 10 deletions
|
@ -11,7 +11,11 @@ RUN wget -O /kaniko/jq \
|
|||
chmod +x /kaniko/jq && \
|
||||
wget -O /kaniko/reg \
|
||||
https://github.com/genuinetools/reg/releases/download/v0.16.1/reg-linux-386 && \
|
||||
chmod +x /kaniko/reg
|
||||
chmod +x /kaniko/reg && \
|
||||
wget -O /crane.tar.gz \
|
||||
https://github.com/google/go-containerregistry/releases/download/v0.1.1/go-containerregistry_Linux_x86_64.tar.gz && \
|
||||
tar -xvzf /crane.tar.gz crane -C /kaniko && \
|
||||
rm crane.tar.gz
|
||||
|
||||
COPY entrypoint.sh /
|
||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
|
|
|
@ -61,7 +61,7 @@ export DOCKERFILE="--dockerfile $CONTEXT_PATH/${INPUT_BUILD_FILE:-Dockerfile}"
|
|||
export TARGET=${INPUT_TARGET:+"--target=$INPUT_TARGET"}
|
||||
|
||||
if [ ! -z $INPUT_SKIP_UNCHANGED_DIGEST ]; then
|
||||
export DESTINATION="--no-push --digest-file digest"
|
||||
export DESTINATION="--digest-file digest --tarPath image.tar --destination $IMAGE"
|
||||
else
|
||||
export DESTINATION="--destination $IMAGE"
|
||||
if [ ! -z $IMAGE_LATEST ]; then
|
||||
|
@ -101,16 +101,15 @@ if [ ! -z $INPUT_SKIP_UNCHANGED_DIGEST ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
export DESTINATION="--destination $IMAGE"
|
||||
if [ ! -z $IMAGE_LATEST ]; then
|
||||
export DESTINATION="$DESTINATION --destination $IMAGE_LATEST"
|
||||
fi
|
||||
|
||||
export ARGS="$CACHE $CONTEXT $DOCKERFILE $TARGET $DESTINATION $INPUT_EXTRA_ARGS"
|
||||
|
||||
echo "Pushing image..."
|
||||
|
||||
/kaniko/executor --reproducible $ARGS >/dev/null 2>&1
|
||||
/kaniko/crane auth login $REGISTRY -u $USERNAME -p $PASSWORD
|
||||
/kaniko/crane push image.tar $IMAGE
|
||||
|
||||
if [ ! -z $IMAGE_LATEST ]; then
|
||||
echo "Tagging latest..."
|
||||
/kaniko/crane tag $IMAGE latest
|
||||
fi
|
||||
|
||||
echo "Done 🎉️"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue