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'
|
description: 'Custom path for Kaniko cache layers'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
build_args:
|
||||||
|
description: 'Optional build arguments separated by spaces or newlines (e.g., KEY=VAL)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
|
|
@ -56,11 +60,19 @@ runs:
|
||||||
CACHE_REPO_ARG="${{ inputs.cache_repo }}"
|
CACHE_REPO_ARG="${{ inputs.cache_repo }}"
|
||||||
fi
|
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
|
# 5. Fire Kaniko executor
|
||||||
/kaniko/executor \
|
/kaniko/executor \
|
||||||
--context="dir://${{ forgejo.workspace }}" \
|
--context="dir://${{ forgejo.workspace }}" \
|
||||||
--dockerfile="${{ forgejo.workspace }}/${{ inputs.dockerfile_path }}" \
|
--dockerfile="${{ forgejo.workspace }}/${{ inputs.dockerfile_path }}" \
|
||||||
$TARGET_ARG \
|
$TARGET_ARG \
|
||||||
|
$DYNAMIC_BUILD_ARGS \
|
||||||
--destination="$REGISTRY_DOMAIN/${{ inputs.destination_image }}:${{ inputs.image_tag }}" \
|
--destination="$REGISTRY_DOMAIN/${{ inputs.destination_image }}:${{ inputs.image_tag }}" \
|
||||||
--cache=true \
|
--cache=true \
|
||||||
--cache-repo="$CACHE_REPO_ARG" \
|
--cache-repo="$CACHE_REPO_ARG" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue