-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-be
49 lines (37 loc) · 1.46 KB
/
Dockerfile-be
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
# Use the official maven/Java 11 image to create a build artifact.
# https://hub.docker.com/_/maven
FROM maven:3.6.3-openjdk-11-slim as builder
WORKDIR app
COPY pom.xml .
#RUN ./mvnw
#COPY . .
#ENTRYPOINT [ "/bin/sh", "ls -l", "."]
RUN mvn dependency:go-offline -B -N
# Copy all pom files
COPY utils/pom.xml ./utils/pom.xml
COPY mqtt-to-queue-connector/pom.xml ./mqtt-to-queue-connector/pom.xml
COPY queue-messages/pom.xml ./queue-messages/pom.xml
COPY office-backend/pom.xml ./office-backend/pom.xml
# Download dependencies from poms
RUN mvn -B -e \
-C org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline \
-DexcludeGroupIds=com.github.flock-community
# Copy src files
COPY utils ./utils
COPY queue-messages ./queue-messages
COPY mqtt-to-queue-connector ./mqtt-to-queue-connector
COPY office-backend ./office-backend
# Build a release artifact.
RUN mvn verify -am -pl office-backend
# Explode jar
RUN mkdir -p office-backend/target/dependency && (cd office-backend/target/dependency; jar -xf ../*.jar)
#
## Runner
FROM adoptopenjdk/openjdk14:alpine-jre
# Copy necessary contents from build to runner
ARG DEPENDENCY=/app/office-backend/target/dependency
COPY --from=builder ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=builder ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=builder ${DEPENDENCY}/BOOT-INF/classes /app
EXPOSE 8080
ENTRYPOINT ["java", "-cp", "app:app/lib/*", "flock.community.office.monitoring.backend.OfficeBackendApplicationKt"]