build.sh 724 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # Set temp environment vars
  3. export GOPATH=/tmp/go
  4. export PATH=${PATH}:${GOPATH}/bin
  5. # Install build deps
  6. apk -U --no-progress add linux-pam-dev go@community gcc musl-dev
  7. # Init go environment to build Gogs
  8. mkdir -p ${GOPATH}/src/github.com/gogits/
  9. ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs
  10. cd ${GOPATH}/src/github.com/gogits/gogs
  11. go get -v -tags "sqlite redis memcache cert pam"
  12. go build -tags "sqlite redis memcache cert pam"
  13. # Cleanup GOPATH
  14. rm -r $GOPATH
  15. # Remove build deps
  16. apk --no-progress del linux-pam-dev go gcc musl-dev
  17. # Create git user for Gogs
  18. adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
  19. echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile