aboutsummaryrefslogtreecommitdiff
path: root/setup/docker/build.sh
blob: 31ee60a035edfee0aa08ff4f961a1eeb423b5126 (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
#!/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}