1
0
Fork 0
A Forgejo Action for Kaniko which builds container images in Kubernetes
Find a file
2024-11-30 13:00:34 +00:00
.forgejo/workflows Add .forgejo/workflows/validate.yaml 2024-11-09 12:50:12 +00:00
.releaserc.json chore: add a few files and a readme 2024-11-10 11:29:21 +01:00
.pre-commit-config.yaml chore: add a few files and a readme 2024-11-10 11:29:21 +01:00
action.yml Update action.yml 2024-11-30 13:00:20 +00:00
Dockerfile Update Dockerfile 2024-11-04 21:17:23 +00:00
entrypoint.sh Update entrypoint.sh 2024-11-30 13:00:34 +00:00
LICENSE chore: add a few files and a readme 2024-11-10 11:29:21 +01:00
README.md Update README.md 2024-11-10 10:29:57 +00:00
renovate.json Add renovate.json 2024-11-03 13:09:26 +00:00

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.