Repository navigation
Support configuring ENTRYPOINT and CMD - #271
Merged
Merged
Conversation
ENTRYPOINT and CMDENTRYPOINT and CMD
along the way, remove Thunk.Cmd and instead just use args NOTE: a few things will likely be broken on top of this.
<> are too subtle, {{foo}}/bar is much easier to read than <foo>/bar
Feels confusing in Bass thunk syntax. Dockerfiles don't respect them
either.
(from (linux/alpine/git)
($ clone))
(from (linux/alpine/git)
($ git clone)) ; much more recognizeable!
I could see Bass respecting them if/when it supports directly running an
image like (run (linux/redis)) though.
vito
force-pushed
the
entrypoints
branch
3 times, most recently
from
April 9, 2023 05:33
f008961 to
de08fb9
Compare
this led to pretty confusing errors; it should only be used for decoding Values, not general unmarshaling
this is a bit half-baked, just formalling marking the current decision secret values are never encoded, because who knows where they'll end up. in the long term there should be a way to fetch secrets on the runtime side, but that's not implemented yet. for now, we'll just skip the secret tests for the gRPC suite.
* (resolve), (docker-build), and the new (oci-load) return a thunk
instead of an "image"
"Image" was a sort of nebulous type; it was never its own type, it was
really just a scope that had a certain set of fields. This was awkward
because it meant you couldn't do the equivalent to this:
FROM golang
ENTRYPOINT ["go", "build"]
But now you can, because it returns a thunk!
(-> (linux/golang)
(with-entrypoint ["go" "build"]))
Same goes for (docker-build), and (oci-load) has been added and
follows the same pattern.
The returned thunk has no arguments set; it only has an image. More on
this in the next point.
* If you tell a thunk to run, and the thunk has no arguments, it will
inherit the ENTRYPOINT and CMD from its base image.
This applies to (run), (read), thunk paths, and thunk addresses.
It does NOT apply to (publish) or (export) as the intention is to
publish the ENTRYPOINT/CMD, not run it.
* Now that (resolve) returns a thunk you'll also notice much smaller
bass.lock files (thunks get their own marshaling, images marshaled as
a scope, which is pretty verbose).
On the other hand, you'll also have to remove your bass.lock files or
bass --bump them since the old stored return value is no longer valid.
* Stop relying on nil vs. [] distinction for clearing ENTRYPOINT/CMD
since it's not possible to represent with protobufs.
* Exposed ports are now included in published image config.
this was hard to figure out, but it works, and should be close to what Dagger does. there is probably be a better way to model this, but I think it achieves the desired semantics.
like ($), but uses the entrypoint. it's *almost* sufficient to rely on 'default args' here instead, but the two are for different things at the end of the day.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change brings Bass closer to alignment with Dagger and Docker with how
ENTRYPOINT/CMD(aka "default args") are handled.Quick terminology note: "default args" is a modern spin on
CMDsince everyone should be usingENTRYPOINTthese days and in that contextCMDactually behaves as default args to the entrypoint. Dagger uses this new terminology, and so will Bass.The tl;dr:
($ foo)does use the entrypoint. This is intentional, and mirrorsRUNin Dockerfiles.($$)has been added for running a command using the entrypoint, replacing any default args.(resolve)(and by extension(linux/foo)) now return a thunk instead of a nebulous "image type" that was really just a scope with certain fields.(docker-build)also now returns a thunk, and(oci-load)has been added to assist with turning OCI tarballs into thunks.Here are the tests, which probably tell the story more thoroughly: