build.sh 812 B

1234567891011121314151617181920212223242526272829
  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. # Install build deps
  8. apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev
  9. # Build Gogs
  10. mkdir -p ${GOPATH}/src/github.com/gogits/
  11. ln -s /app/gogs/build ${GOPATH}/src/github.com/gogits/gogs
  12. cd ${GOPATH}/src/github.com/gogits/gogs
  13. # Needed since git 2.9.3 or 2.9.4
  14. git config --global http.https://gopkg.in.followRedirects true
  15. make build TAGS="sqlite cert pam"
  16. # Cleanup GOPATH
  17. rm -r $GOPATH
  18. # Remove build deps
  19. apk --no-progress del build-deps
  20. # Create git user for Gogs
  21. addgroup -S git
  22. adduser -G git -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && usermod -p '*' git && passwd -u git
  23. echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile