An advanced build system based on Buildkit in order to generate compact Docker images with MetaCall runtime.
Find a file
Vicente Eduardo Ferrer Garcia f4b524da6a
Update builder.sh
2024-11-21 13:07:13 -05:00
.github/workflows Update lint.yml 2024-11-21 11:41:53 -05:00
cmd builder_cache (#29) 2024-08-27 18:14:47 -04:00
docs feat(docs): add arch document 2023-02-27 21:45:06 +08:00
pkg Uncommenting wasm, java as they work (#37) 2024-10-11 12:36:27 +02:00
registry Trying to solve issues with registry. 2024-06-18 23:28:00 +02:00
scripts Update builder.sh 2024-11-21 13:07:13 -05:00
test builder_cache (#29) 2024-08-27 18:14:47 -04:00
.dockerignore Update Dockerfile (#31) (#38) 2024-11-21 11:37:51 -05:00
.env Add base for docker compose. 2024-06-18 01:08:37 +02:00
.gitattributes Trying to add a registry to push the images. 2024-06-18 22:37:29 +02:00
.gitignore minor changes to ReadMe 2024-07-08 23:26:51 +05:30
docker-compose.yml Update docker-compose.yml 2024-11-21 11:58:55 -05:00
Dockerfile Update Dockerfile 2024-11-21 12:28:33 -05:00
go.mod change to scripts installation instead of manual deps and flags and code improvement in general (#20) 2024-06-12 11:09:04 -04:00
go.sum change to scripts installation instead of manual deps and flags and code improvement in general (#20) 2024-06-12 11:09:04 -04:00
LICENSE Initial commit, added license. 2021-10-05 02:30:04 +02:00
README.md Add doc about testing. 2024-07-23 19:16:21 +02:00
TODO.md build metacall base image 2022-01-26 03:22:37 +05:30

MetaCall Builder

Advanced builder based on Buildkit for selectively build compact Docker images selecting the only required languages.

Build

go build cmd/main.go

Run

./main runtime py node rb | buildctl build --output type=docker,name=imagename | docker load

if 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=true

After getting the llb, you can use various buildkit args to specify output

Run with buildctl-daemonless

Linux Requirements:

MacOs:

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 lima

Using Docker:

If 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/buildkit

Export 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 load

Run with docker

Use the environment variable BUILDER_ARGS for passing the arguments.

With daemon:

BUILDER_ARGS="runtime py" docker compose up --exit-code-from client client

Rootless:

BUILDER_ARGS="runtime node" docker compose up --exit-code-from rootless rootless

You can also run the builder binary only:

BUILDER_ARGS="runtime rb" docker compose up --exit-code-from binary binary

Linter

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.59.1 golangci-lint run -v --enable-all

Testing

For testing in rootless mode:

./test/test.sh rootless

For testing in daemon mode:

./test/test.sh client

Useful Tools

Dive 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