🚀 Enable building multiarch images

This commit is contained in:
Lars Gohr
2022-04-09 22:25:56 +02:00
parent 7a7d2b76d3
commit cbaa32c746
4 changed files with 72 additions and 5 deletions

View File

@@ -62,10 +62,16 @@ main() {
exit 0
fi
push
if ! uses "${INPUT_PLATFORMS}"; then
push
fi
echo "::set-output name=tag::${FIRST_TAG}"
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${DOCKERNAME})
if uses "${INPUT_PLATFORMS}"; then
DIGEST=$(jq -r '."containerimage.digest"' metadata.json)
else
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${DOCKERNAME})
fi
echo "::set-output name=digest::${DIGEST}"
docker logout
@@ -184,7 +190,12 @@ build() {
for TAG in ${TAGS}; do
BUILD_TAGS="${BUILD_TAGS}-t ${INPUT_NAME}:${TAG} "
done
docker build ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT}
if uses "${INPUT_PLATFORMS}"; then
local PLATFORMS="--platform ${INPUT_PLATFORMS}"
docker buildx build --push --metadata-file metadata.json ${PLATFORMS} ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT}
else
docker build ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT}
fi
}
push() {