This container image contains tools for building and managing container images. Container is based on scratch but contains minimal shell tools from busybox.
- Busybox
- Kaniko
- Manifest Tool
- Skopeo
- Credential Helpers
- ENV for Docker Hub, GitLab Container Registry etc.
- AWS ECR
- Google Clous GCR
Build container image and push it to GitLab Registru.
export DOCKER_registry_gitlab_com_USR="${CI_REGISTRY_USER}"
export DOCKER_registry_gitlab_com_PSW="${CI_REGISTRY_PASSWORD}"
kaniko --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"
As you can see we don't need to create any docker config.json file. But wes use power of Creds Helpers. In this case ENV Cred Helper.
If you want to build multiarch images with kaniko you need to build separate image on HW with that arch. And than join them with manifest.
include:
- remote: https://raw.githubusercontent.com/cookielab/container-image-tools/main/.gitlab/multi-arch.yml
variables:
DOCKER_registry_gitlab_com_USR: "${CI_REGISTRY_USER}"
DOCKER_registry_gitlab_com_PSW: "${CI_REGISTRY_PASSWORD}"
REGISTRY_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"
build:
extends: .multiarch
script:
- kaniko --build-arg TARGETARCH="${TARGETARCH}" --destination "${REGISTRY_IMAGE}-${TARGETARCH}"
build-multiarch:
extends: .manifest
needs:
- build