Skip to content
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

Allow to specify the name of the Dockerfile #2187

Closed
leovct opened this issue Feb 19, 2024 · 3 comments · Fixed by #2223
Closed

Allow to specify the name of the Dockerfile #2187

leovct opened this issue Feb 19, 2024 · 3 comments · Fixed by #2223
Labels

Comments

@leovct
Copy link
Contributor

leovct commented Feb 19, 2024

Background & motivation

By default, ImageBuildSpec will search for a file called Dockerfile in the build_context_dir. I would like to be able to specify the name of the Dockerfile via an optional argument.

Just like what docker build allows:

$ docker build --help | grep file
    -f, --file string                   Name of the Dockerfile (default: "PATH/Dockerfile")

Btw I'm open to work on this to get more familiar with the code base if possible :)

Desired behaviour

Here is the new specification of ImageBuildSpec with an optional additional argument called file.

image = ImageBuildSpec(
      # Name to give built image
      # MANDATORY
      image_name="kurtosistech/example-datastore-server"
      
      # Locator to build context within the Kurtosis package
      # MANDATORY
      build_context_dir="./server"

      # Name of the Dockerfile
      # By default, Kurtosis expects a Dockerfile at the root of the build context.
      # OPTIONAL
      file="mycustomfile.Dockerfile"
      
      # Stage of image build to target for multi-stage container image
      # OPTIONAL
      target_stage=""
)

How important is this to you?

Nice to have; this feature would make using Kurtosis more enjoyable.

What area of the product does this pertain to?

Other: anything not covered by the above

@github-actions github-actions bot added the nice to have Nice to have feature label Feb 19, 2024
@tedim52
Copy link
Contributor

tedim52 commented Feb 20, 2024

Hey @leovct ! This is definitely something we want to support. Thanks for letting us know this would be helpful for you so we can prioritize it internaly!

@mieubrisse
Copy link
Member

Thanks @leovct ; this would help with the applicability of ImageBuildSpec! If we can call this build_file rather than file (to pattern-match build_context_dir and build_args like you suggested in #2214) I'm down to get this in! Would you be open to submitting a PR? It's the same code as in your other ticket:

@leovct
Copy link
Contributor Author

leovct commented Feb 27, 2024

Yep happy to take a look :)

github-merge-queue bot pushed a commit that referenced this issue Feb 29, 2024
## Description:

Allow to specify the Dockerfile name in `ImageBuildSpec`.
Resolves #2187 

- Add a new `build_file` attribute in `ImageBuildSpec`.
- Update `ImageBuildSpec` tests and add custom build file tests
- Update the `ImageBuildSpec`, `TargetStageAttr` validator to `nil`
since it's an optional value.
- Update `ImageBuildSpec`docs.
- (not related) `go mod tidy`.

## Is this change user facing?
✅
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants