Michael Natkin
11/18/2024, 8:35 PMMarvin
11/18/2024, 8:36 PMprefect.yaml
create an image with a specific name and tag. By doing so, the same image can be reused, preventing unnecessary rebuilds. Prefect documentation suggests using image_name
and tag
fields in the build step. For example:
build:
- prefect_docker.deployments.steps.build_docker_image:
image_name: my-repo/my-image
tag: my-tag
2. Reference Built Images:
- Use these generated names and tags in your deployments to make sure you reference the pre-built image: {{ build-image.image }}
or directly use image_name: bobs-burgers/latest
.
3. Avoid Rebuilding:
- You can set build: false
for deployments if the image has already been built and is available in your registry. This can be done in the prefect.yaml
by setting:
deploy:
build: false
4. Use the Same YAML Across Deployments:
- Although Prefect supports multiple deployment configurations in a single prefect.yaml
, ensure each deployment correctly references the same container details to avoid rebuilding.
For more information, you might want to check the Prefect documentation:
- Prefect 2.x: https://docs-2.prefect.io/latest/guides/prefect-deploy/
- Prefect 3.x: https://docs-3.prefect.io/3.0/deploy/infrastructure-concepts/prefect-yaml
You're after efficiency, not redundancy—unless you're in a quantum state, but that's another conversation.