Adding build args support

This commit is contained in:
2025-03-26 21:40:56 +01:00
parent 1b5964266a
commit 92932d3fa7
2 changed files with 13 additions and 0 deletions

View File

@@ -27,6 +27,10 @@ inputs:
description: Comma separated list for building platform description: Comma separated list for building platform
required: false required: false
default: "" default: ""
buildArgs:
description: Comma separated args to pass to the build
required: false
default: ""
exportTarPath: exportTarPath:
description: Whether and where to export the file as a tar image description: Whether and where to export the file as a tar image
required: false required: false

View File

@@ -7,6 +7,7 @@ INPUT_PULL_CACHE=$pullCache
INPUT_DOCKERFILE_PATH=$path INPUT_DOCKERFILE_PATH=$path
INPUT_PLATFORM=$platform INPUT_PLATFORM=$platform
INPUT_EXPORT_TAR=$exportTarPath INPUT_EXPORT_TAR=$exportTarPath
INPUT_BUILD_ARGS=$buildArgs
set -e set -e
@@ -29,6 +30,14 @@ fi;
DOCKER_BUILD_OPTIONS=("--progress" "plain" "-t" "$IMAGE_NAME") DOCKER_BUILD_OPTIONS=("--progress" "plain" "-t" "$IMAGE_NAME")
if [[ -n "${INPUT_BUILD_ARGS}" ]]; then
IFS=',' read -ra allBuildArgs <<< "${INPUT_BUILD_ARGS}"
for dockerArg in "${allBuildArgs[@]}"; do
DOCKER_BUILD_OPTIONS+=("--build-arg" "$dockerArg")
done
fi
if [ -n "$INPUT_PLATFORM" ]; then if [ -n "$INPUT_PLATFORM" ]; then
DOCKER_BUILD_OPTIONS+=("--platform" "$INPUT_PLATFORM" "--pull") DOCKER_BUILD_OPTIONS+=("--platform" "$INPUT_PLATFORM" "--pull")
fi fi