#!/bin/sh #SPDX-FileCopyrightText: 2024 HÃ¥vard Moen # #SPDX-License-Identifier: GPL-3.0-only set -e set -- /kaniko/executor if [ -n "${INPUT_CREDENTIALS}" ] then echo '{"auths": {' > /kaniko/.docker/config.json for CREDENTIAL in ${INPUT_CREDENTIALS} do echo "${CREDENTIAL}" | ( IFS='=' read -r server creds auth="$(echo -n "${creds}" | base64 -w0)" echo "\"${server}\": {\"auth\": \"${auth}\"}," >> /kaniko/.docker/config.json ) done # remove last comma sed -i '$s/,$//' /kaniko/.docker/config.json echo '}}' >> /kaniko/.docker/config.json fi if [ -n "${INPUT_DOCKER_FILE}" ] then set -- "$@" --dockerfile "${INPUT_DOCKER_FILE}" fi if [ -n "${INPUT_CONTEXT}" ] then CONTEXT="${INPUT_CONTEXT}" else CONTEXT=. fi set -- "$@" --context "dir://${CONTEXT}" if [ "${INPUT_PUSH}" = "false" ] then set -- "$@" --no-push fi if [ "${INPUT_CACHE}" = "true" ] && [ -n "${INPUT_CACHE_REPO}" ] then COMMAND="${COMMAND} --cache=true --cache-repo ${INPUT_CACHE_REPO}" set -- "$@" --cache=true --cache-repo "${INPUT_CACHE_REPO}" if [ -n "${INPUT_CACHE_TTL}" ] then set -- "$@" --cache-ttl="${INPUT_CACHE_TTL}" fi fi if [ -n "${INPUT_DESTINATIONS}" ] then for DESTINATION in ${INPUT_DESTINATIONS} do set -- "$@" --destination "${DESTINATION}" done fi if [ -d "${CONTEXT}/LICENSES" ] then licenses="" for l in LICENSES/*; do license=$(basename "$l" .txt) if [ -z "${licenses}" ] then licenses="${license}" else licenses="${licenses} AND ${license}" fi done set -- "$@" --label "org.opencontainers.image.licenses=${licenses}" fi if [ -n "${INPUT_VERSION}" ] then set -- "$@" --label "org.opencontainers.image.version=${INPUT_VERSION}" fi exec "$@"