From 2055d791651e85306825a844b43eb2cb72bc4345 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 22 Jun 2020 17:08:07 +0200 Subject: [PATCH] build: check if installed Golang has a compatible architecture For building a arm64 container image on amd64, it is needed to configure the system specifically for that. In order to prevent including a amd64 executable in a arm64 image, a check has been added. When running an arm64 executable on a amd64 system, an error should occur when cross architecture containers are not supported. This can be triggered when running `make image-cephcsi GO_ARCH=arm64` on a amd64 system. Signed-off-by: Niels de Vos --- deploy/cephcsi/image/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/cephcsi/image/Dockerfile b/deploy/cephcsi/image/Dockerfile index 3f9842cbe..1b75bcdb3 100644 --- a/deploy/cephcsi/image/Dockerfile +++ b/deploy/cephcsi/image/Dockerfile @@ -19,6 +19,9 @@ RUN source /build.env && \ mkdir -p ${GOROOT} && \ curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xzf - -C ${GOROOT} --strip-components=1 +# test if the downloaded version of Golang works (different arch?) +RUN ${GOROOT}/bin/go version && ${GOROOT}/bin/go env + RUN dnf install libcephfs-devel librados-devel librbd-devel /usr/bin/cc make -y ENV GOROOT=${GOROOT} \