add support for multiple build args
This commit is contained in:
parent
e0c9b6ebdd
commit
37f9f7c85a
1 changed files with 12 additions and 0 deletions
12
action.yaml
12
action.yaml
|
|
@ -28,6 +28,10 @@ inputs:
|
|||
description: 'Custom path for Kaniko cache layers'
|
||||
required: false
|
||||
default: ''
|
||||
build_args:
|
||||
description: 'Optional build arguments separated by spaces or newlines (e.g., KEY=VAL)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
|
@ -56,11 +60,19 @@ runs:
|
|||
CACHE_REPO_ARG="${{ inputs.cache_repo }}"
|
||||
fi
|
||||
|
||||
DYNAMIC_BUILD_ARGS=""
|
||||
if [ -n "${{ inputs.build_args }}" ]; then
|
||||
for arg in ${{ inputs.build_args }}; do
|
||||
DYNAMIC_BUILD_ARGS="$DYNAMIC_BUILD_ARGS --build-arg=$arg"
|
||||
done
|
||||
fi
|
||||
|
||||
# 5. Fire Kaniko executor
|
||||
/kaniko/executor \
|
||||
--context="dir://${{ forgejo.workspace }}" \
|
||||
--dockerfile="${{ forgejo.workspace }}/${{ inputs.dockerfile_path }}" \
|
||||
$TARGET_ARG \
|
||||
$DYNAMIC_BUILD_ARGS \
|
||||
--destination="$REGISTRY_DOMAIN/${{ inputs.destination_image }}:${{ inputs.image_tag }}" \
|
||||
--cache=true \
|
||||
--cache-repo="$CACHE_REPO_ARG" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue