From 92932d3fa70411837cbce6532a15e14cede4b315 Mon Sep 17 00:00:00 2001 From: Skydust Date: Wed, 26 Mar 2025 21:40:56 +0100 Subject: [PATCH] Adding build args support --- action.yml | 4 ++++ entrypoint.sh | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/action.yml b/action.yml index b12c85c..331f573 100644 --- a/action.yml +++ b/action.yml @@ -27,6 +27,10 @@ inputs: description: Comma separated list for building platform required: false default: "" + buildArgs: + description: Comma separated args to pass to the build + required: false + default: "" exportTarPath: description: Whether and where to export the file as a tar image required: false diff --git a/entrypoint.sh b/entrypoint.sh index b304993..d8e79aa 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,7 @@ INPUT_PULL_CACHE=$pullCache INPUT_DOCKERFILE_PATH=$path INPUT_PLATFORM=$platform INPUT_EXPORT_TAR=$exportTarPath +INPUT_BUILD_ARGS=$buildArgs set -e @@ -29,6 +30,14 @@ fi; 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 DOCKER_BUILD_OPTIONS+=("--platform" "$INPUT_PLATFORM" "--pull") fi