aboutsummaryrefslogtreecommitdiff
path: root/setup/docker/build.sh
blob: 56d6fc518554777e27c261aea423447b8eaec22e (plain)
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
#!/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/traccar.xml | awk '/config.default/ && !modif { print;printf("    <entry key=\"web.debug\">true</entry>\n");next; modif=1 } {print}'  > ${tmp}/traccar.xml
cp -rf ./setup/default.xml ${tmp}
cp -rf ./schema ${tmp}/schema
cp -rf ./target/tracker-server.jar ${tmp}/traccar-server.jar
cp -rf ./target/lib ${tmp}/lib
cp -rf ./traccar-web/web ${tmp}/web

docker build -t ${company}/${software}:${version} ./setup/docker/

rm -rf ${tmp}