Skip to content

Commit b939318

Browse files
committed
Add new "ArchLastStageFrom" function for getting the effective "base" of the given image (needed for docs generation)
1 parent 6299558 commit b939318

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

go/src/bashbrew/docker.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ type dockerfileMetadata struct {
2525
Froms []string // every "FROM" or "COPY --from=xxx" value (minus named and/or numbered stages in the case of "--from=")
2626
}
2727

28+
// this returns the "FROM" value for the last stage (which essentially determines the "base" for the final published image)
29+
func (r Repo) ArchLastStageFrom(arch string, entry *manifest.Manifest2822Entry) (string, error) {
30+
dockerfileMeta, err := r.archDockerfileMetadata(arch, entry)
31+
if err != nil {
32+
return "", err
33+
}
34+
return dockerfileMeta.StageFroms[len(dockerfileMeta.StageFroms)-1], nil
35+
}
36+
2837
func (r Repo) DockerFroms(entry *manifest.Manifest2822Entry) ([]string, error) {
2938
return r.ArchDockerFroms(arch, entry)
3039
}

0 commit comments

Comments
 (0)