diff --git a/go/Makefile.debian9 b/go/Makefile.debian9 index 2c4dee9f..8c4e3b17 100644 --- a/go/Makefile.debian9 +++ b/go/Makefile.debian9 @@ -1,4 +1,4 @@ -IMAGES := base main darwin arm armhf npcap +IMAGES := base main darwin armhf npcap ARM_IMAGES := base-arm DEBIAN_VERSION := 9 TAG_EXTENSION := -debian9 diff --git a/go/base-arm/Dockerfile.tmpl b/go/base-arm/Dockerfile.tmpl index 97375004..81b7b2d5 100644 --- a/go/base-arm/Dockerfile.tmpl +++ b/go/base-arm/Dockerfile.tmpl @@ -69,11 +69,12 @@ RUN ldd --version WORKDIR / RUN mkdir -p /root/.config/go/telemetry && echo "off 2024-08-23" > /root/.config/go/telemetry/mode +ENV GOTOOLCHAIN local RUN go mod init github.com/elastic/golang-crossbuild-$GOLANG_VERSION-arm \ && go get . \ && go env \ && echo "toolcompile=$(go tool compile -V)" \ - && go build -o /crossbuild /entrypoint.go \ + && CGO_ENABLED=0 GOARCH=arm64 go build -o /crossbuild /entrypoint.go \ && rm -rf /go/* /root/.cache/* /entrypoint.go COPY sdks/libpcap-1.8.1.tar.gz . diff --git a/go/base-arm/rootfs/entrypoint.go b/go/base-arm/rootfs/entrypoint.go index 0e5c2985..159fcb11 100644 --- a/go/base-arm/rootfs/entrypoint.go +++ b/go/base-arm/rootfs/entrypoint.go @@ -25,8 +25,8 @@ by mounting the project inside of a container equipped with cross-compilers. The root of your project's repo should be mounted at the appropriate location on the GOPATH which is set to /go. -While executing the build command the following variables with be added to the -environment: GOOS, GOARCH, GOARM, PLATFORM_ID, CC, and CXX. +While executing the build command the following variables will be added to the +environment: GOOS, GOARCH, GOARM, GOTOOLCHAIN=local, PLATFORM_ID, CC, and CXX. `, RunE: doBuild, SilenceUsage: true, @@ -104,6 +104,7 @@ func buildEnvironment(platform string) (map[string]string, error) { "GOOS": goos, "GOARCH": goarch, "GOARM": goarm, + "GOTOOLCHAIN": "local", // Disable automatic downloads of toolchains for reproducible builds. "PLATFORM_ID": platformID, } diff --git a/go/base/Dockerfile.tmpl b/go/base/Dockerfile.tmpl index bb4acab6..c8a63fda 100644 --- a/go/base/Dockerfile.tmpl +++ b/go/base/Dockerfile.tmpl @@ -62,11 +62,12 @@ RUN ldd --version WORKDIR / RUN mkdir -p /root/.config/go/telemetry && echo "off 2024-08-23" > /root/.config/go/telemetry/mode +ENV GOTOOLCHAIN=local RUN go mod init github.com/elastic/golang-crossbuild-$GOLANG_VERSION \ && go get . \ && go env \ && echo "toolcompile=$(go tool compile -V)" \ - && CGO_ENABLED=0 go build -o /crossbuild /entrypoint.go \ + && CGO_ENABLED=0 GOARCH=amd64 go build -o /crossbuild /entrypoint.go \ && rm -rf /go/* /root/.cache/* /entrypoint.go COPY sdks/libpcap-1.8.1.tar.gz . diff --git a/go/base/rootfs/entrypoint.go b/go/base/rootfs/entrypoint.go index 0e5c2985..159fcb11 100644 --- a/go/base/rootfs/entrypoint.go +++ b/go/base/rootfs/entrypoint.go @@ -25,8 +25,8 @@ by mounting the project inside of a container equipped with cross-compilers. The root of your project's repo should be mounted at the appropriate location on the GOPATH which is set to /go. -While executing the build command the following variables with be added to the -environment: GOOS, GOARCH, GOARM, PLATFORM_ID, CC, and CXX. +While executing the build command the following variables will be added to the +environment: GOOS, GOARCH, GOARM, GOTOOLCHAIN=local, PLATFORM_ID, CC, and CXX. `, RunE: doBuild, SilenceUsage: true, @@ -104,6 +104,7 @@ func buildEnvironment(platform string) (map[string]string, error) { "GOOS": goos, "GOARCH": goarch, "GOARM": goarm, + "GOTOOLCHAIN": "local", // Disable automatic downloads of toolchains for reproducible builds. "PLATFORM_ID": platformID, }