-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: added option to persist auto-generated Dockerfile #17866
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @AliLordLoss — this is shaping up nicely!
I have two small requests to help make this even better:
- In
build_docker_image
, could you add a log message when the generated Dockerfile is saved? It would be helpful to let users know they should update thedockerfile
field in their configuration, since otherwise a new file will be generated on each run. - Could you add a couple of tests to cover the new functionality?
Let me know if you have any questions or need help with either!
Hi there @desertaxle, I'll certainly try to address your requests. |
…kerfile to address newly added dockerfile persistence feature
@desertaxle I added some tests but they're failing, it seems like it's using the old version of the |
Yep, you should add tests to |
@@ -221,6 +238,18 @@ def build_docker_image( | |||
with Path(temp_dockerfile).open("w") as f: | |||
f.writelines(line + "\n" for line in lines) | |||
|
|||
if persist_dockerfile: | |||
logger.info( | |||
"Persisting auto-generated Dockerfile to disk. You can use `dockerfile_output_path` to specify the output path." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is closer to the log message I had in mind:
"Persisting auto-generated Dockerfile to disk. You can use `dockerfile_output_path` to specify the output path." | |
f"Persisting auto-generated Dockerfile to {dockerfile_output_path or 'Dockerfile.generated'}. Please update your 'dockerfile' value to use this Dockerfile for subsequent runs." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @AliLordLoss, I think you might have accidentally reverted your code changes instead of the changes to tests/cli/test_deploy.py
😅
This reverts commit 30a4c3b.
Yeah, sorry 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with the @AliLordLoss! I have one more small nit, but once that's addressed, this will be good to merge!
src/integrations/prefect-docker/prefect_docker/deployments/steps.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
You're welcome! That's done as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @AliLordLoss!
Fix for #12938
Adds
persist_dockerfile
anddockerfile_output_path
parameters to thebuild_docker_image
step. This allows users to keep the auto-generated Dockerfile for inspection or reuse.
By default, the Dockerfile is still deleted after the build unless
persist_dockerfile
is set to True.Closes #12938
Checklist
<link to issue>
"mint.json
.