diff options
-rw-r--r-- | .gitmodules | 2 | ||||
-rw-r--r-- | Dockerfile | 70 | ||||
-rw-r--r-- | docker-compose.yml | 17 | ||||
-rw-r--r-- | pipeline.yml | 50 | ||||
m--------- | traccar-web | 0 |
5 files changed, 138 insertions, 1 deletions
diff --git a/.gitmodules b/.gitmodules index 5e245cc5b..bae9530d4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "traccar-web"] path = traccar-web - url = ../traccar-web.git + url = ../trackermap-web branch = master ignore = all diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e73f81f7c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,70 @@ +FROM alpine:3.18 as build_server + +######################## +# Build Traccar server # +######################## + +RUN apk add --no-cache --no-progress \ + gcompat \ + libgcc \ + libstdc++ \ + openjdk11-jre-headless + +WORKDIR /build + +ADD build.gradle ./ +ADD gradle ./gradle +ADD gradlew ./ +ADD settings.gradle ./ +ADD src ./src + +RUN ./gradlew assemble + +FROM alpine:3.18 as build_web + +#################### +# Build Traccar UI # +#################### + +RUN apk add --no-cache --no-progress npm + +WORKDIR /build + +ADD traccar-web/modern/.env ./ +ADD traccar-web/modern/.eslintrc.json ./ +ADD traccar-web/modern/.npmrc ./ +ADD traccar-web/modern/index.html ./ +ADD traccar-web/modern/package.json ./ +ADD traccar-web/modern/package-lock.json ./ +ADD traccar-web/modern/vite.config.js ./ +ADD traccar-web/modern/public/ ./public +ADD traccar-web/modern/src/ ./src + +RUN echo 'timeout=60000' > ~/.npmrc && \ + npm install && \ + npm run build + +FROM alpine:3.18 + +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +################## +# Deploy locally # +################## + +RUN apk add --no-cache --no-progress openjdk11-jre-headless + +WORKDIR /opt/traccar + +COPY --from=build_server /build/target . +COPY --from=build_web /build/build ./modern + +ADD setup/default.xml ./conf/default.xml +ADD setup/traccar.xml ./conf/traccar.xml +ADD schema ./schema +ADD templates ./templates + +RUN mkdir logs/ data/ media/ + +CMD ["/usr/bin/java", "-Xms1g", "-Xms1g", "-jar", "tracker-server.jar", "-c", "conf/traccar.xml"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..434f12de0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' + +services: + trackermap: + build: + context: . + dockerfile: Dockerfile + # Configure memory limits here! + command: ["/usr/bin/java", "-Xms1g", "-Xms1g", "-Xss1m", "-jar", "tracker-server.jar", "-c", "conf/traccar.xml"] + ports: + - 8082:8082 + - 5001-5211:5001-5211 + volumes: + - ./conf:/opt/traccar/conf:ro + - ./data:/opt/traccar/data + - ./logs:/opt/traccar/logs + - ./media:/opt/traccar/media diff --git a/pipeline.yml b/pipeline.yml new file mode 100644 index 000000000..82691813b --- /dev/null +++ b/pipeline.yml @@ -0,0 +1,50 @@ +resources: + - name: trackermap-server-git + type: git + source: + uri: ((git-repo)) + tag_filter: trackermap-* + fetch_tags: "true" + + - name: docker-image + type: registry-image + icon: docker + source: + repository: ((registry-repo)) + username: ((registry-username)) + password: ((registry-password)) + tag: latest + +jobs: + - name: build-and-publish + plan: + - get: trackermap-server-git + trigger: true + - task: build-docker + privileged: true + config: + platform: linux + image_resource: + type: registry-image + source: + repository: concourse/oci-build-task + tag: latest + inputs: + - name: trackermap-server-git + outputs: + - name: image + run: + path: sh + args: + - -exc + - | + cd trackermap-server-git/ + git describe --tags | sed 's/trackermap-//' > ../image/tag + export BUILD_ARG_GIT_COMMIT=$(git rev-parse HEAD) + cd ../ + export CONTEXT=trackermap-server-git + build + - put: docker-image + params: + image: image/image.tar + additional_tags: image/tag diff --git a/traccar-web b/traccar-web -Subproject 42db1a41cbf733ea4f82c86e5d45a6fbccc8b8f +Subproject c9da10062998a231c038cd3a519f72128fcea2b |