build.sh 915 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. set -x
  3. set -e
  4. # Set temp environment vars
  5. export GOPATH=/tmp/go
  6. export PATH=${PATH}:${GOPATH}/bin
  7. export GO15VENDOREXPERIMENT=1
  8. # Install build deps
  9. apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev go
  10. # Install glide
  11. git clone -b 0.10.2 https://github.com/Masterminds/glide ${GOPATH}/src/github.com/Masterminds/glide
  12. cd ${GOPATH}/src/github.com/Masterminds/glide
  13. make build
  14. go install
  15. # Build Gogs
  16. mkdir -p ${GOPATH}/src/github.com/gogits/
  17. ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs
  18. cd ${GOPATH}/src/github.com/gogits/gogs
  19. glide install
  20. make build TAGS="sqlite cert pam"
  21. # Cleanup GOPATH & vendoring dir
  22. rm -r $GOPATH /app/gogs/vendor
  23. # Remove build deps
  24. apk --no-progress del build-deps
  25. # Create git user for Gogs
  26. adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
  27. echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile