mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 21:08:01 +00:00
Hashicorp has recently added arm64 builds with their recent 0.14 release: https://www.hashicorp.com/blog/announcing-hashicorp-terraform-0-14-general-availability > Terraform 0.14 also adds official support for Linux ARM64 builds. > We’ve gone further and added Linux ARM64 support in the latest 0.13.x releases. Similarly, recent versions of popular providers are also published with arm64 builds. This change updates the build script in order to produce an arm64 binary. This would be useful, for example, for running in the cloud with one of Amazon graviton2 instance types, or at a smaller scale on a Raspberry Pi 3 (or newer).
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# define architecture we want to build
|
|
XC_ARCH=${XC_ARCH:-"386 amd64 arm arm64"}
|
|
XC_OS=${XC_OS:-linux darwin}
|
|
XC_EXCLUDE_OSARCH="!darwin/arm !darwin/386 !darwin/arm64"
|
|
|
|
# clean up
|
|
echo "-> running clean up...."
|
|
rm -rf output/*
|
|
|
|
if ! which gox > /dev/null; then
|
|
echo "-> installing gox..."
|
|
# Need to run go get in a separate dir
|
|
# so it doesn't modify our go.mod.
|
|
SRC_DIR=$(pwd)
|
|
cd $(mktemp -d)
|
|
go mod init example.com/m
|
|
go get -u github.com/mitchellh/gox
|
|
cd "$SRC_DIR"
|
|
fi
|
|
|
|
# build
|
|
# we want to build statically linked binaries
|
|
export CGO_ENABLED=0
|
|
echo "-> building..."
|
|
gox \
|
|
-os="${XC_OS}" \
|
|
-arch="${XC_ARCH}" \
|
|
-osarch="${XC_EXCLUDE_OSARCH}" \
|
|
-output "output/{{.OS}}_{{.Arch}}/atlantis" \
|
|
.
|
|
|
|
# Zip and copy to the dist dir
|
|
echo ""
|
|
echo "Packaging..."
|
|
for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do
|
|
OSARCH=$(basename ${PLATFORM})
|
|
echo "--> ${OSARCH}"
|
|
|
|
pushd $PLATFORM >/dev/null 2>&1
|
|
zip ../atlantis_${OSARCH}.zip ./*
|
|
popd >/dev/null 2>&1
|
|
done
|
|
|
|
echo ""
|
|
echo ""
|
|
echo "-----------------------------------"
|
|
echo "Output:"
|
|
ls -alh output/
|