瀏覽代碼

Dockerfile: fix PKG_CONFIG for xx

Current implementation in hack/make.sh overwrites PKG_CONFIG
if not defined and set it to pkg-config. When a build is invoked
using xx in our Dockerfile, it will set PKG_CONFIG to the right
value in go environments depending on the target architecture: https://github.com/tonistiigi/xx/blob/8015613cccc2d3b689bf8189ec3604c4e4c94c34/base/xx-go#L75-L78

Also needs to install dpkg-dev to use pkg-config when cross-building

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 71fa3b133744a2f183fbd5e64fd69442287d5017)
CrazyMax 2 年之前
父節點
當前提交
0e4548bbe1
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Dockerfile

+ 2 - 1
Dockerfile

@@ -553,6 +553,7 @@ ARG TARGETPLATFORM
 RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
     --mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
         xx-apt-get install --no-install-recommends -y \
+            dpkg-dev \
             gcc \
             libapparmor-dev \
             libc6-dev \
@@ -581,7 +582,7 @@ RUN --mount=type=bind,target=. \
   set -e
   target=$([ "$DOCKER_STATIC" = "1" ] && echo "binary" || echo "dynbinary")
   xx-go --wrap
-  ./hack/make.sh $target
+  PKG_CONFIG=$(xx-go env PKG_CONFIG) ./hack/make.sh $target
   xx-verify $([ "$DOCKER_STATIC" = "1" ] && echo "--static") /tmp/bundles/${target}-daemon/dockerd$([ "$(xx-info os)" = "windows" ] && echo ".exe")
   xx-verify $([ "$DOCKER_STATIC" = "1" ] && echo "--static") /tmp/bundles/${target}-daemon/docker-proxy$([ "$(xx-info os)" = "windows" ] && echo ".exe")
   mkdir /build