Skip to content

Commit d404b37

Browse files
authored
Merge pull request #980 from krissetto/fix-windows-zig-build
Target correct zig arch during windows build
2 parents 0e17331 + f6c7d4e commit d404b37

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ COPY . ./
5353
RUN --mount=type=cache,target=/root/.cache,id=docker-ai-$TARGETPLATFORM \
5454
--mount=type=cache,target=/go/pkg/mod <<EOT
5555
set -ex
56-
CC="zig cc -target x86_64-windows-gnu" CXX="zig c++ -target x86_64-windows-gnu" xx-go build -trimpath -ldflags "-s -w -X 'github.com/docker/cagent/pkg/version.Version=$GIT_TAG' -X 'github.com/docker/cagent/pkg/version.Commit=$GIT_COMMIT'" -o /binaries/cagent-$TARGETOS-$TARGETARCH .
56+
if [ "$TARGETARCH" = "arm64" ]; then
57+
ZIG_TARGET="aarch64-windows-gnu"
58+
else
59+
ZIG_TARGET="x86_64-windows-gnu"
60+
fi
61+
CC="zig cc -target $ZIG_TARGET" CXX="zig c++ -target $ZIG_TARGET" xx-go build -trimpath -ldflags "-s -w -X 'github.com/docker/cagent/pkg/version.Version=$GIT_TAG' -X 'github.com/docker/cagent/pkg/version.Commit=$GIT_COMMIT'" -o /binaries/cagent-$TARGETOS-$TARGETARCH .
5762
mv /binaries/cagent-$TARGETOS-$TARGETARCH /binaries/cagent-$TARGETOS-$TARGETARCH.exe
5863
xx-verify --static /binaries/cagent-windows-$TARGETARCH.exe
5964
EOT

0 commit comments

Comments
 (0)