add image_tag variable; improve documentation

This commit is contained in:
tertek 2026-10-07 16:22:31 +02:00
commit e04c4fb399
2 changed files with 15 additions and 6 deletions

View file

@ -1,6 +1,6 @@
name: 'Kaniko Build & Push' name: 'Kaniko Build & Push'
description: 'Builds a multi-stage Dockerfile using Kaniko and pushes it to a container registry' description: 'Builds a (multi-stage) Dockerfile using Kaniko and pushes it to container registry'
author: 'Your Name' author: 'tertek'
inputs: inputs:
registry_user: registry_user:
@ -20,6 +20,10 @@ inputs:
destination_image: destination_image:
description: 'The full image name and tag (e.g., my-repo/php-fpm:test)' description: 'The full image name and tag (e.g., my-repo/php-fpm:test)'
required: true required: true
image_tag:
description: 'Name of the image tag, appended to the image name with :latest as default'
required: false
default: 'latest'
cache_repo: cache_repo:
description: 'Custom path for Kaniko cache layers' description: 'Custom path for Kaniko cache layers'
required: false required: false
@ -57,7 +61,7 @@ runs:
--context="dir://${{ forgejo.workspace }}" \ --context="dir://${{ forgejo.workspace }}" \
--dockerfile="${{ forgejo.workspace }}/${{ inputs.dockerfile_path }}" \ --dockerfile="${{ forgejo.workspace }}/${{ inputs.dockerfile_path }}" \
$TARGET_ARG \ $TARGET_ARG \
--destination="$REGISTRY_DOMAIN/${{ inputs.destination_image }}" \ --destination="$REGISTRY_DOMAIN/${{ inputs.destination_image }}:${{ inputs.image_tag }}" \
--cache=true \ --cache=true \
--cache-repo="$CACHE_REPO_ARG" \ --cache-repo="$CACHE_REPO_ARG" \
--compressed-caching --compressed-caching

View file

@ -23,6 +23,10 @@ jobs:
container: container:
image: ghcr.io/osscontainertools/kaniko:alpine image: ghcr.io/osscontainertools/kaniko:alpine
steps: steps:
# Required
- name: Install NodeJS for Action Compatibility
run: apk add --no-cache nodejs
- name: Checkout Source Code - name: Checkout Source Code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -31,7 +35,8 @@ jobs:
with: with:
registry_user: ${{ secrets.REGISTRY_USER }} registry_user: ${{ secrets.REGISTRY_USER }}
registry_token: ${{ secrets.REGISTRY_TOKEN }} registry_token: ${{ secrets.REGISTRY_TOKEN }}
dockerfile_path: 'test-1/Dockerfile' dockerfile_path: 'sub-directory/Dockerfile'
target_stage: 'development' target_stage: 'development' # optional
destination_image: '${{ forgejo.repository }}/foo-image:latest' destination_image: '${{ forgejo.repository }}/my-awesome-image'
image_tag: 'latest' # optional
``` ```