aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrecchia <danilo@deltatecnologia.com>2016-06-09 20:35:24 -0300
committerdrecchia <danilo@deltatecnologia.com>2016-06-09 20:35:24 -0300
commit049bab3bdb25acdf4f0c8cf4eb8cad200b860066 (patch)
treee86f297ff8110ac7bd5800643c7067ff9d40a242
parent3f19cd0c34e5454f5f1feed3465c45ac638cb0d2 (diff)
downloadtraccar-server-049bab3bdb25acdf4f0c8cf4eb8cad200b860066.tar.gz
traccar-server-049bab3bdb25acdf4f0c8cf4eb8cad200b860066.tar.bz2
traccar-server-049bab3bdb25acdf4f0c8cf4eb8cad200b860066.zip
- Docker build script.
-rw-r--r--setup/docker/Dockerfile24
-rw-r--r--setup/docker/build.sh24
2 files changed, 48 insertions, 0 deletions
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