build.sh 842 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. set -x
  3. set -e
  4. # Set temp environment vars
  5. export GOPATH=/tmp/go
  6. export PATH=/usr/local/go/bin:${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
  10. # Build Gogs
  11. mkdir -p ${GOPATH}/src/github.com/gogits/
  12. ln -s /app/gogs/build ${GOPATH}/src/github.com/gogits/gogs
  13. cd ${GOPATH}/src/github.com/gogits/gogs
  14. # Needed since git 2.9.3 or 2.9.4
  15. git config --global http.https://gopkg.in.followRedirects true
  16. make build TAGS="sqlite cert pam"
  17. # Cleanup GOPATH
  18. rm -r $GOPATH
  19. # Remove build deps
  20. apk --no-progress del build-deps
  21. # Create git user for Gogs
  22. addgroup -S git
  23. adduser -G git -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && usermod -p '*' git && passwd -u git
  24. echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile