Skip to content

Commit c40e121

Browse files
committed
Dockerfile: prefer ld for cross-compiling arm64 in bullseye
Signed-off-by: Tonis Tiigi <[email protected]>
1 parent e5d9675 commit c40e121

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ ARG VERSION
5555
# PACKAGER_NAME sets the company that produced the windows binary
5656
ARG PACKAGER_NAME
5757
COPY --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
58+
# in bullseye arm64 target does not link with lld so configure it to use ld instead
59+
RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true
5860
RUN --mount=type=bind,target=.,ro \
5961
--mount=type=cache,target=/root/.cache \
6062
--mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk \
@@ -69,9 +71,9 @@ FROM build-${BASE_VARIANT} AS test
6971
COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum
7072
ENV GO111MODULE=auto
7173
RUN --mount=type=bind,target=.,rw \
72-
--mount=type=cache,target=/root/.cache \
73-
--mount=type=cache,target=/go/pkg/mod \
74-
gotestsum -- -coverprofile=/tmp/coverage.txt $(go list ./... | grep -vE '/vendor/|/e2e/')
74+
--mount=type=cache,target=/root/.cache \
75+
--mount=type=cache,target=/go/pkg/mod \
76+
gotestsum -- -coverprofile=/tmp/coverage.txt $(go list ./... | grep -vE '/vendor/|/e2e/')
7577

7678
FROM scratch AS test-coverage
7779
COPY --from=test /tmp/coverage.txt /coverage.txt

0 commit comments

Comments
 (0)