BuildKit can be used as a build service in Kubernetes
Multiple examples available
Proof-of-concept
BuildKit understands the schema kube-pod://
Multiple pods can run simultaneously
Build is passed to any one of them by the service
–
Pass build to remote pod
Create cluster:
kind create cluster
Run BuildKit daemon:
kubectl apply -f pod.rootless.yaml
Run build:
export BUILDKIT_HOST=kube-pod://buildkitd
buildctl build \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=.
–
Described in my blog post
Published demo on gitlab.com
Service is running next to build job
Connection is configured through variable BUILDKIT_HOST
Using the buildctl-daemonless.sh
script
BuildKit daemon is started on-the-fly
–
Official actions provided by Docker
Based on buildx
Obtain metadata for tagging and labels
Install qemu static binaries for buildx
Setup buildx for multi-platform builds
Login to Docker Hub for pushing images
Build and push container image