Skip to content

feat: add support for DockerfileInline #4305

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tushar5526
Copy link
Contributor

@tushar5526 tushar5526 commented Jun 4, 2025

Fixes #4108

As nerdctl currently uses "nerdctl build" to build the service images, write the inline file to a temporary file and use "-f" to specify the temporary dockerfile.

TODO: Add tests if the approach looks fine.

As nerdctl currently uses "nerdctl build" to build the service
images, write the inline file to a temporary file and use "-f"
to specify the temporary dockerfile.
@tushar5526 tushar5526 marked this pull request as draft June 4, 2025 21:01
@tushar5526
Copy link
Contributor Author

I was a bit confused about where to place this logic: writing the inline file to a temporary path and then modifying the build command to build using that file.

It seems like Build object on Service is something that is meant to be reusable, so I placed the logic of temporary file generation at the time of parsing the service and generating the Build config.

@tushar5526
Copy link
Contributor Author

@apostasie, can I get a cursory review of the approach?

@apostasie
Copy link
Contributor

Hey @tushar5526
Looks fine to me.

You do need to make sure that dockerfile and dockerfileinline cannot be specified together though:
https://docs.docker.com/reference/compose-file/build/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nerdctl compose does not support dockerfile_inline
2 participants