build-go.sh 801 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Build GO version as specified in Dockerfile
  3. set -x
  4. set -e
  5. # Components versions
  6. export GOLANG_VERSION="1.8"
  7. export GOLANG_SRC_URL="https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"
  8. export GOLANG_SRC_SHA256="406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596"
  9. # Install build tools
  10. apk add --no-cache --no-progress --virtual build-deps-go gcc musl-dev openssl go
  11. export GOROOT_BOOTSTRAP="$(go env GOROOT)"
  12. # Download Go
  13. wget -q "$GOLANG_SRC_URL" -O golang.tar.gz
  14. echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c -
  15. tar -C /usr/local -xzf golang.tar.gz
  16. rm golang.tar.gz
  17. # Build
  18. cd /usr/local/go/src
  19. # see https://golang.org/issue/14851
  20. patch -p2 -i /app/gogs/build/docker/no-pic.patch
  21. ./make.bash
  22. # Clean
  23. rm /app/gogs/build/docker/*.patch
  24. apk del build-deps-go