Matthew Bell
03/13/2024, 3:45 PMCMD
for each flow, rather than building a separate image for each, where only CMD
changes.
What is the recommended way of handling Docker images across multiple flows?Marvin
03/13/2024, 3:45 PMCMD
.
Here are the key takeaways:
- Docker-based Storage: This method stores your flow code in a Docker image. Changes to the code have to be pushed manually or through a CI/CD pipeline.
- Custom Images for Complex Dependencies: If your flows require complicated installations or shared libraries, it's best to create a common custom image.
- Reusable Images: You can build a shared custom image for use with multiple flows.
For your situation, if the only change between flows is the CMD
, utilizing a shared Dockerfile and image makes sense. You should consider parametrizing your Dockerfile or entrypoint script to accept arguments or environment variables that change the command or flow being executed.
Refer to these resources for more information:
- Docker-based storage
- Using Docker with Prefect
Try including your flows in a single image, parameterizing the entry point, and specifying the flow to run based on the environment variable or command-line argument passed to the container. This approach should maintain the simplicity of your CI/CD pipeline while reducing the overhead of maintaining multiple nearly identical Docker images.