forked from CodeforLeipzig/lvz-viz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (37 loc) · 1.68 KB
/
Dockerfile
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
FROM node:18-alpine AS build-js
# see https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user
ENV USER node
USER ${USER}
WORKDIR /home/${USER}
COPY --chown=${USER} package*.json ./
RUN npm install --omit=dev
COPY --chown=${USER} Gruntfile.js ./
COPY --chown=${USER} src/main/resources/public/js ./src/main/resources/public/js
RUN npm run --silent grunt-build
FROM gradle:7-jdk17-alpine AS build-java
ENV USER gradle
USER ${USER}
RUN mkdir -p /home/gradle/app/build/resources/main/public/js
WORKDIR /home/gradle/app
COPY --chown=${USER} build.gradle .
COPY --chown=${USER} src ./src
RUN rm -f src/main/resources/public/js/*.js
COPY --chown=${USER} --from=build-js /home/node/build/resources/main/public/js/app.min.js ./src/main/resources/public/js/
RUN gradle --info assemble
FROM eclipse-temurin:17-jre-alpine
LABEL maintainer="Sebastian Peters <[email protected]>" \
org.opencontainers.image.authors="Sebastian Peters <[email protected]>" \
org.opencontainers.image.source="https://github.com/CodeforLeipzig/lvz-viz" \
org.opencontainers.image.vendor="Open Knowledge Foundation Deutschland e.V."
# see https://github.com/adoptium/containers/blob/main/17/jdk/alpine/Dockerfile.releases.full#L26
ENV LANG='de_DE.UTF-8' LANGUAGE='de_DE:de' LC_ALL='de_DE.UTF-8'
RUN echo "Europe/Berlin" > /etc/timezone
ENV USER lvz-viz
RUN addgroup ${USER} \
&& adduser -D -G ${USER} -S ${USER}
USER ${USER}
WORKDIR /home/${USER}
COPY --chown=${USER} dewac_175m_600.crf.ser.gz .
COPY --chown=${USER} --from=build-java /home/gradle/app/build/libs/*.jar ./app.jar
EXPOSE 8080
ENTRYPOINT ["java","-XshowSettings:vm","-XX:MaxRAMPercentage=95","-jar","./app.jar"]