Skip to content

Support dependencies when using bake #447

Description

@howardjohn

It would be useful for bake to automatically determine dependencies during the build phase. For example:

==> docker-bake.hcl <==
target "sleep" {
    tags = ["localhost:5000/sleep"]
    dockerfile = "Dockerfile.sleep"
    output = ["type=registry"]
}
target "main" {
    tags = ["localhost:5000/main"]
    dockerfile = "Dockerfile.main"
    output = ["type=registry"]
}
group "all" {
    targets = ["sleep","main",]
}

==> Dockerfile.main <==
FROM localhost:5000/sleep

==> Dockerfile.sleep <==
FROM alpine

RUN sleep 10

On a fresh build, this will fail with failed to solve: rpc error: code = Unknown desc = failed to load cache key: localhost:5000/sleep:latest: not found

On a build where sleep already exists, we may still want this ordering, to ensure we are getting the newly built sleep rather than the existing remote one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions