Skip to content

bwalding/kaniko

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudBees action: Build and publish Docker images with Kaniko

Use this action to build and publish Docker images using Kaniko, which builds container images from a Dockerfile. Kaniko builds images inside a container or Kubernetes cluster.

Prerequisites

To authenticate with the Docker registry, you must have a Docker config file in the ${HOME}/.docker/config.json path.

Use the OCI credentials configuration action to generate a Docker config file, as in the following example.

In your YAML file, add:

      - id: dockerconfig
        name: Configure container registry credentials
        uses: cloudbees-io/configure-oci-credentials@v1
        with:
          registry: ${{ vars.DOCKER_REGISTRY }}
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

The Docker config file must be formatted in JSON, as follows:

{
	"auths": {
		"<registry host>": {
			"username": "<username>",
			"password": "<password>",
			"auth": "<username>:<password>"
		}
	}
}
Note
The "auth":"<username>:<password>" field must be base64-encoded.

Inputs

Table 1. Input details
Input name Data type Required? Description

dockerfile

String

No

The path to the Dockerfile to be built. Default is Dockerfile.

context

String

No

The path to the build context. Default is ${{ cloudbees.workspace }}.

destination

String

Yes

The target image to be published. Formatted as a CSV list, so you can pass multiple images.

build-args

String

No

The build arguments to be passed to the Kaniko build. Formatted as a CSV list, so you can pass multiple build arguments.

labels

String

No

The label metadata added to the final image. Formatted as a CSV list, so you can pass multiple labels.

Usage example

In your YAML file, add:

      - name: Build a container image with Kaniko
        uses: cloudbees-io/kaniko@v1
        with:
          dockerfile: path/to/Dockerfile
          context: .
          destination: <registry host>/<image name>:1.0.1,<registry host>/<image name>:latest
          build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1,BUILDKIT_INLINE_CACHE=1
          labels: maintainer=John Smith,version=1.0.1

License

This code is made available under the MIT license.

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 96.5%
  • Dockerfile 3.5%