-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·50 lines (39 loc) · 1.2 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
set -ex
# Set temp environment vars
export GOPATH=/tmp/go
export PATH=${PATH}:${GOPATH}/bin
GOGITSPATH="${GOPATH}/src/github.com/gogits"
GOGSPATH="${GOGITSPATH}/gogs"
mkdir -p /app/gogs
mkdir -p "$GOGITSPATH"
case "$GOGS_VERSION" in
v*)
curl -L "https://github.com/gogits/gogs/archive/${GOGS_VERSION}.tar.gz" | \
tar xzC $GOGITSPATH
mv "${GOGITSPATH}/gogs-${GOGS_VERSION##v}" "$GOGSPATH"
;;
*)
cd "$GOGITSPATH"
git clone https://github.com/gogits/gogs.git
cd gogs
git checkout "$GOGS_VERSION"
;;
esac
# Install build deps
apk -U --no-progress add linux-pam-dev go@community gcc musl-dev
# Init go environment to build Gogs
cd "$GOGSPATH"
go get -v -tags "sqlite redis memcache cert pam"
go build -tags "sqlite redis memcache cert pam"
for component in conf public templates gogs; do
cp -a "$GOGSPATH/$component" /app/gogs
done
# generate app.ini.vendor-defaults and app.ini.template
cd /app/gogs/openshift
awk -f build-app-ini.awk "${GOGSPATH}/conf/app.ini"
# Cleanup GOPATH
rm -r "$GOPATH"
# Remove build deps
apk --no-progress del linux-pam-dev go gcc musl-dev
echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile