diff --git a/go/src/bashbrew/docker.go b/go/src/bashbrew/docker.go index 0f9ff3b..dc9b195 100644 --- a/go/src/bashbrew/docker.go +++ b/go/src/bashbrew/docker.go @@ -25,6 +25,15 @@ type dockerfileMetadata struct { Froms []string // every "FROM" or "COPY --from=xxx" value (minus named and/or numbered stages in the case of "--from=") } +// this returns the "FROM" value for the last stage (which essentially determines the "base" for the final published image) +func (r Repo) ArchLastStageFrom(arch string, entry *manifest.Manifest2822Entry) (string, error) { + dockerfileMeta, err := r.archDockerfileMetadata(arch, entry) + if err != nil { + return "", err + } + return dockerfileMeta.StageFroms[len(dockerfileMeta.StageFroms)-1], nil +} + func (r Repo) DockerFroms(entry *manifest.Manifest2822Entry) ([]string, error) { return r.ArchDockerFroms(arch, entry) }