Added an export tar option

This commit is contained in:
2024-12-25 22:43:28 +01:00
parent 0d8c515c9e
commit 349fc1d891
3 changed files with 10 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/alpine:3.20
FROM public.ecr.aws/docker/library/alpine:3.21
RUN apk add --no-cache docker-cli-buildx bash

View File

@@ -27,6 +27,9 @@ inputs:
description: Comma separated list for building platform
required: false
default: ""
exportTarPath:
description: Whether and where to export the file as a tar image
required: false
# Define your outputs here.
outputs:

View File

@@ -6,6 +6,7 @@ INPUT_PUSH_IMAGE=$push
INPUT_PULL_CACHE=$pullCache
INPUT_DOCKERFILE_PATH=$path
INPUT_PLATFORM=$platform
INPUT_EXPORT_TAR=$exportTarPath
set -e
@@ -43,6 +44,10 @@ if [ "$INPUT_PULL_CACHE" = "true" ]; then
echo "Using docker image cache ${IMAGE_CACHE_NAME}"
fi
if [ -n "$INPUT_EXPORT_TAR" ]; then
DOCKER_BUILD_OPTIONS+=("--output" "type=docker,dest=$INPUT_EXPORT_TAR")
fi
DOCKER_BUILD_OPTIONS+=("${INPUT_DOCKERFILE_PATH}")
# shellcheck disable=SC2145
echo "Running docker buildx with options: ${DOCKER_BUILD_OPTIONS[@]}"
@@ -52,6 +57,6 @@ docker buildx build "${DOCKER_BUILD_OPTIONS[@]}"
echo "Cleaning up docker"
docker system prune --all --force
echo "imageName=${IMAGE_NAME}" >>"$GITEA_OUTPUT"
echo "imageName=${IMAGE_NAME}" >> "$GITEA_OUTPUT"
exit 0