diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 69 |
1 files changed, 69 insertions, 0 deletions
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"] |