Advanced builder based on Buildkit for selectively build compact Docker images selecting the only required languages.
go build cmd/main.go./main runtime py node rb | buildctl build --output type=docker,name=imagename | docker loadif you want to push the image to a registry, you can use the following command:
./main runtime py node rb | buildctl build --output type=image,name=docker.io/ashpect/testimage,push=trueAfter getting the llb, you can use various buildkit args to specify output
For MacOs, you can use install buildkit using brew and lima for rootless containers, and run the script after the installation.
$ brew install buildkit
$ brew install limaIf you don't have buildkit installed, you can use the docker image to run the buildkit daemon.
docker run --rm --privileged -d --name buildkit moby/buildkitExport the environment variable BUILDKIT_HOST to point to the buildkit daemon.
export BUILDKIT_HOST=docker-container://buildkit./main py node rb | ./hack/buildctl.sh build --output type=docker,name=imagename | docker loadUse the environment variable BUILDER_ARGS for passing the arguments.
With daemon:
BUILDER_ARGS="runtime py" docker compose up --exit-code-from client clientRootless:
BUILDER_ARGS="runtime node" docker compose up --exit-code-from rootless rootlessYou can also run the builder binary only:
BUILDER_ARGS="runtime rb" docker compose up --exit-code-from binary binarydocker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.59.1 golangci-lint run -v --enable-allFor testing in rootless mode:
./test/test.sh rootlessFor testing in daemon mode:
./test/test.sh clientDive can be used to analyze each layer of the generated image
dive <your-image-tag>This opens up a window where in we can see changes in each layer of the image according to preferences.
Ctrl + L : To show only layer changes
Tab : To switch view from layers to current layer contents