3 ms·
Is there a way to specify an image’s build dependencies without manually grouping targets for parallelization? For example, if image D depends on both B and C
by miiiiiike 2y ago
Is there a way to specify an image’s build dependencies without manually grouping targets for parallelization?
For example, if image D depends on both B and C to be built first and images B and C depended on A.
The build order would be:
0) A builds by itself.
1) B and C builds in parallel.
2) D builds by itself.
I built a tool to do this years ago and I’d really like to retire it.
Compose ignores “depends_on” for builds: https://github.com/docker/compose/issues/6332#issuecomment-437143989 https://github.com/docker/compose/issues/6332#issuecomment-4...
- moltar 2y agoHave you figured it out?
- miiiiiike 2y agoI've been playing with it for the past hour this morning. It looks like it does everything I want it to do and more.
- miiiiiike 2y agoIt all "just works". No "depends_on", you just specify your "FROM" as usual and it just figures it all out for you.
- moltar 2y agoHm, that’s interesting. Are you saying just specifying the FROM in the Dockerfile is enough? I’ve seen a trick floating around specifying from in the bake config in addition to Dockerfile.
- miiiiiike 2y agoKind of, you use contexts. You can create contexts that point to other targets. So in your Dockerfile you can use `FROM project-base` where `project-base` is whatever you specified in the context. See "Pinning an Alpine image" here: https://docs.docker.com/build/bake/contexts/#pinning-alpine-image https://docs.docker.com/build/bake/contexts/#pinning-alpine-...