compose/pkg
Milas Bowman 1fdbcb6255 build: pass BuildOptions around explicitly & fix multi-platform issues
The big change here is to pass around an explicit `*BuildOptions` object
as part of Compose operations like `up` & `run` that may or may not do
builds. If the options object is `nil`, no builds whatsoever will be
attempted.

Motivation is to allow for partial rebuilds in the context of an `up`
for watch. This was broken and tricky to accomplish because various parts
of the Compose APIs mutate the `*Project` for convenience in ways that
make it unusable afterwards. (For example, it might set `service.Build = nil`
because it's not going to build that service right _then_. But we might
still want to build it later!)

NOTE: This commit does not actually touch the watch logic. This is all
      in preparation to make it possible.

As part of this, a bunch of code moved around and I eliminated a bunch
of partially redundant logic, mostly around multi-platform. Several
edge cases have been addressed as part of this:
 * `DOCKER_DEFAULT_PLATFORM` was _overriding_ explicitly set platforms
   in some cases, this is no longer true, and it behaves like the Docker
   CLI now
 * It was possible for Compose to build an image for one platform and
   then try to run it for a different platform (and fail)
 * Errors are no longer returned if a local image exists but for the
   wrong platform - the correct platform will be fetched/built (if
   possible).

Because there's a LOT of subtlety and tricky logic here, I've also tried
to add an excessive amount of explanatory comments.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-09-01 08:32:56 +02:00
..
api build: pass BuildOptions around explicitly & fix multi-platform issues 2023-09-01 08:32:56 +02:00
compose build: pass BuildOptions around explicitly & fix multi-platform issues 2023-09-01 08:32:56 +02:00
e2e up: fix various race/deadlock conditions on exit (#10934) 2023-08-31 10:47:14 -04:00
mocks Add `docker compose wait` 2023-06-30 16:07:03 +02:00
progress progress: minor correctness fixes (#10871) 2023-08-03 15:14:17 -04:00
prompt use a simpler prompt implementation when we lack a terminal 2023-01-09 10:28:16 +01:00
remote watch: only allow a single instance per-project 2023-08-25 15:49:28 +02:00
utils logs: fix for missing output on container exit (#10925) 2023-08-23 08:57:18 -04:00
watch replace dockerfile/dockerignore with patternmatcher/ignorefile 2023-08-23 00:43:17 +02:00