Windows still writes to the autogen directory, but the source code is
mounted in as read-only.
In order to do enable this without taking a massive hit in doing an rw
mount (for the source code) we mount a tmpfs into the build at the
autogen dir.
In order for this to work the directory must alreay exist, so we create
it before entering the build.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -354,6 +354,7 @@ FROM binary-base AS build-cross |
| 354 | 354 |
ARG DOCKER_CROSSPLATFORMS |
| 355 | 355 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
| 356 | 356 |
--mount=type=bind,target=/go/src/github.com/docker/docker \ |
| 357 |
+ --mount=type=tmpfs,target=/go/src/github.com/docker/docker/autogen \ |
|
| 357 | 358 |
hack/make.sh cross |
| 358 | 359 |
|
| 359 | 360 |
FROM scratch AS binary |
| ... | ... |
@@ -172,7 +172,14 @@ cross: ## cross build the binaries for darwin, freebsd and\nwindows |
| 172 | 172 |
|
| 173 | 173 |
cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS |
| 174 | 174 |
|
| 175 |
-binary dynbinary cross: buildx |
|
| 175 |
+# This is only used to work around read-only bind mounts of the source code into |
|
| 176 |
+# binary build targets. We end up mounting a tmpfs over autogen which allows us |
|
| 177 |
+# to write build-time generated assets even though the source is mounted read-only |
|
| 178 |
+# ...But in order to do so, this dir needs to already exist. |
|
| 179 |
+autogen: |
|
| 180 |
+ mkdir -p autogen |
|
| 181 |
+ |
|
| 182 |
+binary dynbinary cross: buildx autogen |
|
| 176 | 183 |
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) . |
| 177 | 184 |
|
| 178 | 185 |
build: target = --target=final |