.forgejo/workflows | ||
.releaserc.json | ||
.pre-commit-config.yaml | ||
action.yml | ||
Dockerfile | ||
entrypoint.sh | ||
LICENSE | ||
README.md | ||
renovate.json |
kaniko-action
Build and optionally push Docker images in Kubernetes using Kaniko
without access to docker.sock
.
This action allows you to build container images using Kaniko in Forgejo workflows. You can also optionally push the built images to a registry.
Note: Kaniko requires a privileged container.
Example Workflow
Here's an example of how to use this action in your workflow:
name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
build:
runs-on: flakes-action
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and push
uses: https://code.252.no/tommy/kaniko-action@latest
with:
cache: false
context: /workspace/${{ github.repository }}
credentials: |
code.252.no=${{ github.repository_owner }}:${{ secrets.REGISTRY_TOKEN }}
destinations: "code.252.no/tommy/mbpfan:${{ steps.meta.outputs.tags }}"
push: 'true'
In this example, the action builds the Docker image defined in Dockerfile located at the root of the repository, and pushes it to
myregistry.com/myimage:latest
.
Inputs
cache: (optional) Set this flag to true to enable caching with Kaniko. Defaults to false
.
cache_repo: (required if cache is true) Repository to use for cache.
cache_ttl: (optional) Cache timeout in hours. Defaults to Kaniko default.
context: (optional) Path to the build context. Defaults to the workspace
.
credentials: (optional) Whitespace separated list of authentication credentials in the format registry_server=user:password
.
destinations: (required if push is true) Destinations to push images to, whitespace separated.
docker_file: (optional) Path to the Dockerfile. Defaults to Dockerfile. It must be in the context.
push: (optional) Push an image to the registry. Defaults to true
.
version: (optional) Version of the software, to be added as org.opencontainers.image.version
label.