aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-10 11:49:27 +1200
committerGitHub <noreply@github.com>2016-06-10 11:49:27 +1200
commite966778c43ee4a2fa12705cded8648b96ef78f61 (patch)
treee86f297ff8110ac7bd5800643c7067ff9d40a242 /setup
parent5a2c64cd99134e98e311d694a76d3d22703496c2 (diff)
parent049bab3bdb25acdf4f0c8cf4eb8cad200b860066 (diff)
downloadtrackermap-server-e966778c43ee4a2fa12705cded8648b96ef78f61.tar.gz
trackermap-server-e966778c43ee4a2fa12705cded8648b96ef78f61.tar.bz2
trackermap-server-e966778c43ee4a2fa12705cded8648b96ef78f61.zip
Merge pull request #2009 from drecchia/master-docker
Official Docker build script
Diffstat (limited to 'setup')
-rw-r--r--setup/README.txt1
-rw-r--r--setup/docker/Dockerfile24
-rw-r--r--setup/docker/build.sh24
-rwxr-xr-xsetup/package.sh8
-rw-r--r--setup/unix/traccar.xml2
-rw-r--r--setup/windows/traccar.iss2
6 files changed, 55 insertions, 6 deletions
diff --git a/setup/README.txt b/setup/README.txt
index 071cb1d8c..c50b392e2 100644
--- a/setup/README.txt
+++ b/setup/README.txt
@@ -4,6 +4,7 @@ Installation instructions are available on the official website:
Windows - https://www.traccar.org/windows/
Linux - https://www.traccar.org/linux/
+Docker - https://www.traccar.org/docker/
OS X - https://www.traccar.org/mac-os/
OpenBSD - https://www.traccar.org/openbsd/
FreeBSD - https://www.traccar.org/freebsd/
diff --git a/setup/docker/Dockerfile b/setup/docker/Dockerfile
new file mode 100644
index 000000000..a39cad79c
--- /dev/null
+++ b/setup/docker/Dockerfile
@@ -0,0 +1,24 @@
+FROM java:8-alpine
+
+MAINTAINER Danilo Recchia <danilo.recchia@vortus.solutions>
+
+RUN apk upgrade --update && \
+ apk add --update curl bash && \
+ rm -rf /var/cache/apk/* && \
+ mkdir -p /opt/traccar/logs && \
+ mkdir -p /opt/traccar/data
+
+ENV JAVA_OPTS -Xms256m -Xmx1024m
+
+COPY ./tmp/traccar.xml /opt/traccar/traccar.xml
+COPY ./tmp/schema /opt/traccar/schema
+COPY ./tmp/web /opt/traccar/web
+COPY ./tmp/lib /opt/traccar/lib
+COPY ./tmp/traccar-server.jar /opt/traccar/traccar-server.jar
+
+EXPOSE 8082
+EXPOSE 5000-5150
+
+WORKDIR /opt/traccar
+
+ENTRYPOINT ["java","-jar","traccar-server.jar","traccar.xml"] \ No newline at end of file
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
diff --git a/setup/package.sh b/setup/package.sh
index 0fe0fd5a9..a7b58b599 100755
--- a/setup/package.sh
+++ b/setup/package.sh
@@ -102,7 +102,7 @@ package_windows () {
package_unix () {
- mkdir -p out/{bin,conf,data,lib,logs,web}
+ mkdir -p out/{bin,conf,data,lib,logs,web,schema}
cp wrapper/src/bin/sh.script.in out/bin/traccar
cp wrapper/lib/wrapper.jar out/lib
@@ -113,7 +113,7 @@ package_unix () {
cp ../target/tracker-server.jar out
cp ../target/lib/* out/lib
- cp ../database/* out/data
+cp ../schema/* out/schema
cp -r ../web/* out/web
cp unix/traccar.xml out/conf
@@ -140,11 +140,11 @@ package_unix () {
package_universal () {
- mkdir -p out/{conf,data,lib,logs,web}
+ mkdir -p out/{conf,data,lib,logs,web,schema}
cp ../target/tracker-server.jar out
cp ../target/lib/* out/lib
- cp ../database/* out/data
+ cp ../schema/* out/schema
cp -r ../web/* out/web
cp windows/traccar.xml out/conf
cp README.txt out
diff --git a/setup/unix/traccar.xml b/setup/unix/traccar.xml
index 03ba845fc..d8d4a1084 100644
--- a/setup/unix/traccar.xml
+++ b/setup/unix/traccar.xml
@@ -31,7 +31,7 @@
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>
- <entry key='database.changelog'>/opt/traccar/data/changelog-master.xml</entry>
+ <entry key='database.changelog'>/opt/traccar/schema/changelog-master.xml</entry>
<entry key='database.selectServers'>
SELECT * FROM server;
diff --git a/setup/windows/traccar.iss b/setup/windows/traccar.iss
index 33d8f6837..56de5c1a6 100644
--- a/setup/windows/traccar.iss
+++ b/setup/windows/traccar.iss
@@ -83,6 +83,6 @@ begin
StringChangeEx(S, '[WEB]', ExpandConstant('{app}\web'), true);
StringChangeEx(S, '[LOG]', ExpandConstant('{app}\logs\tracker-server.log'), true);
StringChangeEx(S, '[DATABASE]', ExpandConstant('{app}\data\database'), true);
- StringChangeEx(S, '[CHANGELOG]', ExpandConstant('{app}\data\changelog-master.xml'), true);
+ StringChangeEx(S, '[CHANGELOG]', ExpandConstant('{app}\schema\changelog-master.xml'), true);
SaveStringToFile(ExpandConstant(CurrentFileName), S, false);
end;