forked from ox-it/wl-sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·39 lines (32 loc) · 1.45 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
#!/bin/sh
#
# Short build script.
local_version=$(git describe --tags)
local_sakai=10.x
# If any command fails abort the build
set -e
# Check we have the correct java version
java_version=$(java -version 2>&1 | sed -n 's/^java version *"\(.*\)"/\1/p')
if echo $java_version | grep -q "1\.7\..*" ; then
echo Found Sun JDK: $java_version
else
echo You have to build with Sun JDK 1.7.x, we found:
java -version 2>&1
exit 1
fi
git submodule init
git submodule sync
git submodule update
# This checks that all the submodule are free from local changes.
# It checks for staged changes and also for removed files.
# The update-index is also needed to get the index back in sync with the filesystem ( git status does this behind the scenes ).
# To get everything back in sync do:
# git submodule update -f
git submodule foreach 'git update-index -q --refresh ; git diff-index --cached --quiet HEAD && git diff-files --quiet'
MAVEN_OPTS="-Xms168m -Xmx768m -XX:PermSize=128m -XX:NewSize=64m -Dmaven.test.skip=true"
export MAVEN_OPTS
rm -rf $(pwd)/docker/sakai-prod/tomcat
mvn clean install sakai:deploy -Dlocal.service=$local_version -Dlocal.sakai=$local_sakai -Dmaven.tomcat.home=$(pwd)/docker/sakai-prod/tomcat
docker build -t oxit/weblearn:${local_version} docker/sakai-prod
docker push oxit/weblearn:${local_version}
docker save oxit/weblearn:${local_version} | ssh linux.ox.ac.uk "cat > /afs/ox.ac.uk/vhost/weblearn.ox.ac.uk/werp/docker_images/sakai-${local_version}.tar"