blob: 4b9e27609713f52c10a4d15fab386a9578e7fa05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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"]
|