-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support configuring ENTRYPOINT
and CMD
#271
Merged
Merged
Conversation
This file contains 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
vito
changed the title
Respect and allow configuring
Support configuring Apr 7, 2023
ENTRYPOINT
and CMD
ENTRYPOINT
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.
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
CMD
since everyone should be usingENTRYPOINT
these days and in that contextCMD
actually 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 mirrorsRUN
in 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: