From 43c892c45f1f858cda98c549056eb352816932aa Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 12:19:40 -0300 Subject: [PATCH 1/2] feat: add docker hub as default registry --- .vscode/settings.json | 3 +++ action.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c60674c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["elif", "kaniko"] +} diff --git a/action.yml b/action.yml index 3d61d87..5d351e8 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,4 @@ --- - name: Kaniko description: Build a container image using Kaniko inputs: @@ -11,7 +10,8 @@ inputs: required: true registry: description: Domain of the registry. Should be the same as the first path component of the tag. - required: true + required: false + default: https://index.docker.io/v1/ username: description: Username for the container registry required: true From 20209e6c170594b474d1b5ec02e6ffb0a178c679 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 12:20:18 -0300 Subject: [PATCH 2/2] feat: read Dockerfile from local file system --- action.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 5d351e8..53f469a 100644 --- a/action.yml +++ b/action.yml @@ -2,9 +2,9 @@ name: Kaniko description: Build a container image using Kaniko inputs: - Dockerfile: + dockerfile: description: The Dockerfile to pass to Kaniko - required: true + required: false image: description: Name and tag under which to upload the image required: true @@ -27,7 +27,16 @@ runs: - | mkdir -p /kaniko/.docker echo '{"auths":{"${{ inputs.registry }}":{"auth":"'$(printf "%s:%s" "${{ inputs.username }}" "${{ inputs.password }}" | base64 | tr -d '\n')'"}}}' > /kaniko/.docker/config.json - cat > Dockerfile < Dockerfile + elif [ -f "./Dockerfile" ]; then + echo "Using existing ./Dockerfile from workspace" + cp ./Dockerfile Dockerfile + else + echo "ERROR: No Dockerfile provided and no ./Dockerfile found in workspace" + exit 1 + fi + + /kaniko/executor --dockerfile Dockerfile --destination "${{ inputs.image }}"