build.sh 621 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. set -e
  3. # This is pretty dirty hack. Building imgproxy under Qemu is pretty slow.
  4. # So we install Go binary native for the BUILDARCH.
  5. if [[ $BUILDARCH != $TARGETARCH ]]; then
  6. GOLANG_VERSION=$(go version | sed -E 's/.*go([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/')
  7. rm -rf /usr/local/go
  8. apt-get update
  9. apt-get install -y --no-install-recommends libstdc++6:${BUILDARCH}
  10. curl -Ls https://golang.org/dl/go${GOLANG_VERSION}.linux-${BUILDARCH}.tar.gz \
  11. | tar -xzC /usr/local
  12. export CGO_ENABLED=1
  13. export GOOS=linux
  14. export GOARCH=$TARGETARCH
  15. fi
  16. go build -v -ldflags "-s -w" -o /usr/local/bin/imgproxy