You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for preserving and labeling intermediate stage images
This adds support for preserving and labeling intermediate stage images
in multi-stage builds. In contrast to the --layers flag, --cache-stages
preserves only the final image from each named stage (FROM ... AS name),
not every instruction layer. This also keeps the final image's layer count
unchanged compared to a regular build.
New flags:
- --cache-stages: preserve intermediate stage images instead of removing them
- --stage-labels: add metadata labels to intermediate stage images (stage name,
base image, build ID, parent stage name). Requires --cache-stages.
- --build-id-file: write unique build ID (UUID) to file for easier
identification and grouping of intermediate images from a single build.
Requires --stage-labels.
The implementation also includes:
- Detection of transitive alias patterns (stage using another intermediate
stage as base)
- Validation that --stage-labels requires --cache-stages
- Validation that --build-id-file requires --stage-labels
- Test coverage (15 tests) and documentation updates
This functionality is useful for debugging, exploring, and reusing
intermediate stage images in multi-stage builds.
Signed-off-by: Erik Mravec <[email protected]>
This will clone the specified GitHub repository from the URL and use it as context. The Containerfile or Dockerfile at the root of the repository is used as the context of the build. This only works if the GitHub repository is a dedicated repository.
fs.StringSliceVarP(&flags.File, "file", "f", []string{}, "`pathname or URL` of a Dockerfile")
254
259
fs.StringVar(&flags.Format, "format", DefaultFormat(), "`format` of the built image's manifest and metadata. Use BUILDAH_FORMAT environment variable to override.")
255
260
fs.StringVar(&flags.Iidfile, "iidfile", "", "`file` to write the image ID to")
261
+
fs.StringVar(&flags.BuildIdFile, "build-id-file", "", "`file` to write the build ID to")
256
262
fs.IntVar(&flags.Jobs, "jobs", 1, "how many stages to run in parallel")
257
263
fs.StringArrayVar(&flags.Label, "label", []string{}, "set metadata for an image (default [])")
258
264
fs.StringArrayVar(&flags.LayerLabel, "layer-label", []string{}, "set metadata for an intermediate image (default [])")
0 commit comments