Docker Builder Image for cross-building Golang Prometheus projects.
latest,main,1.27.0-main,1.27.0-main(1.27.0/main/Dockerfile)arm,1.27.0-arm,1.27.0-arm(1.27.0/arm/Dockerfile)powerpc,1.27.0-powerpc,1.27.0-powerpc(1.27.0/powerpc/Dockerfile)mips,1.27.0-mips,1.27.0-mips(1.27.0/mips/Dockerfile)s390x,1.27.0-s390x,1.27.0-s390x(1.27.0/s390x/Dockerfile)1.26-main,1.26.7-main(1.26/main/Dockerfile)arm,1.26-arm,1.26.7-arm(1.26/arm/Dockerfile)powerpc,1.26-powerpc,1.26.7-powerpc(1.26/powerpc/Dockerfile)mips,1.26-mips,1.26.7-mips(1.26/mips/Dockerfile)s390x,1.26-s390x,1.26.7-s390x(1.26/s390x/Dockerfile)
Change the repository import path (-i) and target platforms (-p) according to your needs.
You can also use those images to run your tests by using the -T option.
Usage: builder.sh [args]
-i,--import-path arg : Go import path of the project
-p,--platforms arg : List of platforms (GOOS/GOARCH) to build separated by a space
-T,--tests : Go run tests then exit
This building process is using make to build and run tests.
Therefore a Makefile with build and test targets is needed into the root of your source files.
docker run --rm -ti -v $(pwd):/app quay.io/prometheus/golang-builder:main \
-i "github.com/prometheus/prometheus" \
-p "linux/amd64 linux/386 darwin/amd64 darwin/386 windows/amd64 windows/386 freebsd/amd64 freebsd/386 openbsd/amd64 openbsd/386 netbsd/amd64 netbsd/386 dragonfly/amd64"
docker run --rm -ti -v $(pwd):/app quay.io/prometheus/golang-builder:arm \
-i "github.com/prometheus/prometheus" \
-p "linux/arm linux/arm64 freebsd/arm openbsd/arm netbsd/arm"
docker run --rm -ti -v $(pwd):/app quay.io/prometheus/golang-builder:powerpc \
-i "github.com/prometheus/prometheus" \
-p "linux/ppc64 linux/ppc64le"
mips64/mips64le cross-build is currently available with golang 1.6.
docker run --rm -ti -v $(pwd):/app quay.io/prometheus/golang-builder:mips \
-i "github.com/prometheus/prometheus" \
-p "linux/mips64 linux/mips64le"
Darwin CGO cross-compilation uses Zig as the C compiler, combined with the macOS SDK provided by the GitHub-hosted macOS runner (the latest SDK available at image build time). Builds target macOS 12 (Monterey) and later, which is the minimum version supported by Go.
This is not a general-purpose macOS cross-compilation toolchain. It is scoped to the CGO surface needed by Prometheus ecosystem projects and may not support every CGO use case.
OSX/Darwin/Apple builds: Please ensure you have read and understood the Xcode license terms before continuing.
- You will find a Circle CI configuration in
circle.yml. - All of the core developers are accessible via the Prometheus Developers Mailinglist and the
#prometheuschannel onirc.freenode.net.
Refer to CONTRIBUTING.md
Apache License 2.0, see LICENSE.