Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a Bass Buildkit frontend, so you can write a Dockerfile like this:
The first line tells Buildkit to use the
basslang/frontend:dev
container to build the Dockerfile. This means you can use Bass anywhere you can use a Dockerfile. No installation or setup necessary.The Bass frontend evaluates the script, which must return a thunk, which the frontend then builds using the Buildkit runtime.
*dir*
will be the path containing the script, if it is different from the context dir. Use it for loading Bass code.*context*
will be the context dir. Use it as your build input. (I might consolidate this into*dir*
.)Almost everything works, with a few exceptions which don't seem like dealbreakers given the use case:
(docker-build)
(Add(write)
,(publish)
, and(docker-build)
#270) using the Buildkit runtime.(publish)
will not work because Buildkit doesn't support exporting in the gateway interface.(publish)
in a Dockerfile anyway. I'm not sure if this should be fixed really.(write)
will not work because the filesystem is not writable. This is doesn't really fit the use case either. Actually it might just do something really weird. I haven't tried.For a more complicated example see Bass's own Dockerfile which reuses Bass's existing CI code to create an image for running
bass
:Unfortunately this can't be built with
docker build
because it uses a service (Nixery) for building images. I'm hoping to replace that with a regularnix build
instead -- using this frontend!Until then, here's a Bass script that runs it:
I'll be waiting for some nerd to waltz in and see a
Dockerfile
in the repo and think "Ha! So much for defeating Dockerfiles!" only to open it and see Bass code.TODO:
*context*
? should*dir*
just be script dir and the context dir? I'm not sure when they would ever be different. Dagger and the Docker CLI don't seem to let you do this.*env*
?DiscardFilesystem
so(write)
doesn't do strange things (*dir*
is technically a host path, but its context dir refers to a named input, not a directory).nix build
.