build.sh 738 B

123456789101112131415161718192021222324252627
  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. # Install build deps
  8. apk -U --no-progress add linux-pam-dev go@community gcc musl-dev
  9. # Init go environment to build Gogs
  10. mkdir -p ${GOPATH}/src/github.com/gogits/
  11. ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs
  12. cd ${GOPATH}/src/github.com/gogits/gogs
  13. go get -v -tags "sqlite redis memcache cert pam"
  14. go build -tags "sqlite redis memcache cert pam"
  15. # Cleanup GOPATH
  16. rm -r $GOPATH
  17. # Remove build deps
  18. apk --no-progress del linux-pam-dev go gcc musl-dev
  19. # Create git user for Gogs
  20. adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
  21. echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile