Skip to content

Latest commit

 

History

History
 
 

ko

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

ko

Status stable
OCI Reference cgr.dev/chainguard/ko
Variants/Tags

Contact Chainguard for enterprise support, SLAs, and access to older tags.


This is an image that contains ko, go, and build-base.

This image is designed for use in situations where you would like to use ko with codebases that have C dependencies where cgo must be used. In these cases, staticly linking against musl instead of glibc results in smaller binaries.

Get It!

The image is available on cgr.dev:

docker pull cgr.dev/chainguard/ko:latest

Usage

Using with CGO

Navigate to the example/ directory:

cd example/

Then run:

docker run --rm -it \
  -v ${PWD}:/work \
  --workdir=/work \
  -e KO_DOCKER_REPO=example.com \
  -e CGO_ENABLED=1 \
  cgr.dev/chainguard/ko build ./ \
    --push=false \
    --preserve-import-paths

This will build the example program, but not push it, due to --push=false.

To push, you will need to mount in your Docker config to provide auth by adding:

  -v $DOCKER_CONFIG:/docker-config \
  -e DOCKER_CONFIG=/docker-config \

If you're using Docker credential helpers, those will need to be made available in the container as well so that ko can invoke them.