Giter Site home page Giter Site logo

ashpect / builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metacall/builder

0.0 0.0 0.0 232 KB

An advanced build system based on Buildkit in order to generate compact Docker images with MetaCall runtime.

License: Apache License 2.0

Shell 26.63% Go 64.95% Dockerfile 8.27% JavaScript 0.15%

builder's Introduction

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

builder's People

Contributors

viferga avatar skant7 avatar ashpect avatar iyear avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.