build-release.sh 713 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. #
  3. # Build all release binaries and images to directory ./release.
  4. # Run from repository root.
  5. #
  6. set -e
  7. VERSION=$1
  8. if [ -z "${VERSION}" ]; then
  9. echo "Usage: ${0} VERSION" >> /dev/stderr
  10. exit 255
  11. fi
  12. if ! command -v docker >/dev/null; then
  13. echo "cannot find docker"
  14. exit 1
  15. fi
  16. ETCD_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
  17. pushd "${ETCD_ROOT}" >/dev/null
  18. echo Building etcd binary...
  19. ./scripts/build-binary "${VERSION}"
  20. for TARGET_ARCH in "amd64" "arm64" "ppc64le"; do
  21. echo Building ${TARGET_ARCH} docker image...
  22. GOOS=linux GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-docker "${VERSION}"
  23. done
  24. popd >/dev/null