diff options
-rw-r--r-- | .gitmodules | 2 | ||||
-rw-r--r-- | Dockerfile | 69 | ||||
-rw-r--r-- | docker-compose.yml | 17 | ||||
-rw-r--r-- | pipeline.yml | 85 | ||||
m--------- | traccar-web | 0 |
5 files changed, 172 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..4b9e27609 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,69 @@ +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/.env ./ +ADD traccar-web/.eslintrc.json ./ +ADD traccar-web/.npmrc ./ +ADD traccar-web/index.html ./ +ADD traccar-web/package.json ./ +ADD traccar-web/package-lock.json ./ +ADD traccar-web/vite.config.js ./ +ADD traccar-web/public/ ./public +ADD traccar-web/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 ./web + +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..05f4627a7 --- /dev/null +++ b/pipeline.yml @@ -0,0 +1,85 @@ +resources: + - name: trackermap-server-git + type: git + source: + uri: ((server-git-url)) + tag_filter: trackermap-* + fetch_tags: "true" + + - name: trackermap-branding-git + type: git + source: + uri: ((branding-git-url)) + branch: main + + - 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 + + - get: trackermap-branding-git + trigger: false + + - task: apply-branding + config: + platform: linux + image_resource: + type: registry-image + source: + repository: alpine + tag: latest + inputs: + - name: trackermap-server-git + - name: trackermap-branding-git + outputs: + - name: trackermap-branded + path: trackermap-server-git + params: + BRANDING: ((branding)) + run: + path: sh + args: + - -c + - | + cd trackermap-branding-git/ + ./rebrand.sh "$BRANDING" ../trackermap-server-git + + - task: build-docker + privileged: true + config: + platform: linux + image_resource: + type: registry-image + source: + repository: concourse/oci-build-task + tag: latest + inputs: + - name: trackermap-branded + outputs: + - name: image + run: + path: sh + args: + - -exc + - | + cd trackermap-branded/ + git describe --tags | sed 's/trackermap-//' > ../image/tag + export BUILD_ARG_GIT_COMMIT=$(git rev-parse HEAD) + cd ../ + export CONTEXT=trackermap-branded + build + + - put: docker-image + params: + image: image/image.tar + additional_tags: image/tag diff --git a/traccar-web b/traccar-web -Subproject f164e722ae67768ed90bc0036045829afd96419 +Subproject f574d9c1c9fa89788838faf0b1a39a0e7d4c675 |