From 2b0bd34d4791ade31a8ce793327dace1c02615d1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 2 Jul 2022 15:39:02 +0200 Subject: [PATCH] Dockerfile: don't install delve on ppc64le, s390x Delve on Linux is currently only supported on amd64 and arm64; https://github.com/go-delve/delve/blob/v1.8.1/pkg/proc/native/support_sentinel.go#L1-L6 On ppc64le and s390x, trying to install and run it, caused the build to fail: RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod GOBIN=/build/ GO111MODULE=on go install "github.com/go-delve/delve/cmd/dlv@v1.8.1" && /build/dlv --help: pkg/mod/github.com/go-delve/delve@v1.8.1/service/debugger/debugger.go:28:2: found packages native (dump_linux.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /go/pkg/mod/github.com/go-delve/delve@v1.8.1/pkg/proc/native Error: failed to solve: executor failed running [/bin/sh -c GOBIN=/build/ GO111MODULE=on go install "github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}" && /build/dlv --help]: exit code: 1 Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd157eb049..aa8f6551b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -154,10 +154,19 @@ FROM base AS delve # attaching debugger to it. # ARG DELVE_VERSION=v1.8.1 +# Delve on Linux is currently only supported on amd64 and arm64; +# https://github.com/go-delve/delve/blob/v1.8.1/pkg/proc/native/support_sentinel.go#L1-L6 RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ - GOBIN=/build/ GO111MODULE=on go install "github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}" \ - && /build/dlv --help + case $(dpkg --print-architecture) in \ + amd64|arm64) \ + GOBIN=/build/ GO111MODULE=on go install "github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}" \ + && /build/dlv --help \ + ;; \ + *) \ + mkdir -p /build/ \ + ;; \ + esac FROM base AS tomll # GOTOML_VERSION specifies the version of the tomll binary to build and install