浏览代码

Merge pull request #40439 from cpuguy83/fix_windows_cross

Fix windows cross builds.
Sebastiaan van Stijn 5 年之前
父节点
当前提交
513b207b00
共有 3 个文件被更改,包括 10 次插入2 次删除
  1. 1 0
      Dockerfile
  2. 8 1
      Makefile
  3. 1 1
      hack/make/.go-autogen

+ 1 - 0
Dockerfile

@@ -354,6 +354,7 @@ FROM binary-base AS build-cross
 ARG DOCKER_CROSSPLATFORMS
 RUN --mount=type=cache,target=/root/.cache/go-build \
     --mount=type=bind,target=/go/src/github.com/docker/docker \
+    --mount=type=tmpfs,target=/go/src/github.com/docker/docker/autogen \
         hack/make.sh cross
 
 FROM scratch AS binary

+ 8 - 1
Makefile

@@ -172,7 +172,14 @@ cross: ## cross build the binaries for darwin, freebsd and\nwindows
 
 cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
 
-binary dynbinary cross: buildx
+# This is only used to work around read-only bind mounts of the source code into
+# binary build targets. We end up mounting a tmpfs over autogen which allows us
+# to write build-time generated assets even though the source is mounted read-only
+# ...But in order to do so, this dir needs to already exist.
+autogen:
+	mkdir -p autogen
+
+binary dynbinary cross: buildx autogen
 	$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
 
 build: target = --target=final

+ 1 - 1
hack/make/.go-autogen

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-rm -rf autogen
+rm -rf autogen/*
 
 source hack/dockerfile/install/runc.installer
 source hack/dockerfile/install/tini.installer