golang-crossbuild is a set of Docker images containing the requisite cross-compilers for cross compiling Go applications. The cross-compilers are needed when the application uses cgo.
The base image used is Debian 9 (stretch) unless otherwise specified.
docker.elastic.co/beats-dev/golang-crossbuild:[TAG]
1.10.8-main
,1.11.13-main
,1.12.12-main
,1.13.12-main
,1.14.15-main
,1.15.10-main
,1.16.3-main
- linux/{amd64,386} and windows/{amd64,386}1.10.8-arm
,1.11.13-arm
,1.12.12-arm
,1.13.12-arm
,1.14.15-arm
,1.15.10-arm
,1.16.3-arm
- linux/{armv5,armv6,armv7,arm64}1.10.8-darwin
,1.11.13-darwin
,1.12.12-darwin
,1.13.12-darwin
,1.14.15-darwin
,1.16.3-darwin
- darwin/{386}1.10.8-darwin
,1.11.13-darwin
,1.12.12-darwin
,1.13.12-darwin
,1.14.15-darwin
,1.15.10-darwin
,1.16.3-darwin
- darwin/{amd64}1.10.8-ppc
,1.11.13-ppc
,1.12.12-ppc
,1.13.12-ppc
,1.14.15-ppc
,1.15.10-ppc
,1.16.3-ppc
- linux/{ppc64,ppc64le}1.10.8-mips
,1.11.13-mips
,1.12.12-mips
,1.13.12-mips
,1.14.15-mips
,1.15.10-mips
,1.16.3-mips
- linux/{mips,mipsle,mips64,mips64le}1.10.8-s390x
,1.11.13-s390x
,1.12.12-s390
,1.13.12-s390
,1.14.15-s390
,1.15.10-s390
,1.16.3-s390
- linux/s390x1.10.8-main-debian7
,1.11.13-main-debian7
,1.12.12-debian7
,1.13.12-debian7
,1.14.15-debian7
,1.15.10-debian7
,1.16.3-debian7
- linux/{amd64,386} and windows/{amd64,386} (Debian 7 uses glibc 2.13 so the resulting binaries (if dynamically linked) have greater compatibility.)1.10.8-main-debian8
,1.11.13-main-debian8
,1.12.12-main-debian8
,1.13.12-debian8
,1.14.15-debian8
,1.15.10-debian8
,1.16.3-debian8
- linux/{amd64,386} and windows/{amd64,386} (Debian 8 uses glibc 2.19)1.15.10-debian9
,1.16.3-debian9
- linux/{amd64,386} and windows/{amd64,386} (Debian 9 uses glibc 2.24)1.15.10-base-arm-debian9
,1.16.3-base-arm-debian9
- linux/arm64 (Debian 9 uses glibc 2.24)1.15.10-debian10
,1.16.3-debian10
- linux/{amd64,386} and windows/{amd64,386} (Debian 10 uses glibc 2.28)
docker run -it --rm \
-v $GOPATH/src/github.com/user/go-project:/go/src/github.com/user/go-project \
-w /go/src/github.com/user/go-project \
-e CGO_ENABLED=1 \
docker.elastic.co/beats-dev/golang-crossbuild:1.10.8-arm \
--build-cmd "make build" \
-p "linux/armv7"
This will execute your projects make build
target. While executing the build
command the following variables with be added to the environment: GOOS, GOARCH,
GOARM, PLATFORM_ID, CC, and CXX.
- Update the Docker tag in Makefile.common and/or Makefile.common and/or Makefile.common.
- Update the Go version and SHA256 in the Dockerfile(s). The SHA256 must be obtained from https://golang.org/dl/.
- Update the versions listed in this README.md.
- Commit the changes.
git add -u && git commit -m 'Update to Go 1.x.y'
. - Create a Pull Request with the description
'Update to Go 1.x.y'
. - When merging the PR then the automation will release those docker images.
This is not required unless the CI service is down.
- Build the images from the project's root with
make
. - Get a logon token for the container registry by visiting https://docker.elastic.co:7000.
- Publish the images with
make push
.