aboutsummaryrefslogtreecommitdiff
path: root/setup/docker/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup/docker/build.sh')
-rw-r--r--setup/docker/build.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/setup/docker/build.sh b/setup/docker/build.sh
new file mode 100644
index 000000000..31ee60a03
--- /dev/null
+++ b/setup/docker/build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+which mvn &> /dev/null || { echo >&2 "Maven package cant be found on path. Aborting."; exit 1; }
+which awk &> /dev/null || { echo >&2 "Awk package cant be found on path. Aborting."; exit 1; }
+which docker &> /dev/null || { echo >&2 "Docker package cant be found on path. Aborting."; exit 1; }
+mvn package || { echo >&2 "Maven package has failed. Aborting."; exit 1; }
+
+export company="tananaev"
+export software="traccar"
+export version=$(head -n 10 ./pom.xml |grep version|cut -d ">" -f2|cut -d"<" -f1)
+
+tmp="./setup/docker/tmp"
+
+mkdir -p ${tmp}
+
+cat ./setup/unix/traccar.xml | awk '/web.path/ && !modif { printf(" <entry key=\"web.debug\">true</entry>\n"); modif=1 } {print}' > ${tmp}/traccar.xml
+cp -rf ./schema ${tmp}/schema
+cp -rf ./target/tracker-server.jar ${tmp}/traccar-server.jar
+cp -rf ./target/lib ${tmp}/lib
+cp -rf ./web ${tmp}/web
+
+docker build -t ${company}/${software}:${version} ./setup/docker/
+
+rm -rf ${tmp} \ No newline at end of file