-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (21 loc) · 872 Bytes
/
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
# Build stage
FROM maven:3.6.3-jdk-11-slim AS build
WORKDIR /workspace/app
COPY pom.xml .
RUN mvn dependency:go-offline -B
COPY src src
RUN mvn package -DskipTests
RUN mkdir -p target/dependency \
&& (cd target/dependency; jar -xfv ../kube-hello-app-exec.jar)
# Production Stage for Spring boot application image
FROM openjdk:8-jre-alpine
VOLUME /tmp
ARG DEPENDENCY="/workspace/app/target/dependency"
RUN addgroup -S spring \
&& adduser -S spring -G spring
COPY --from="build" ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from="build" ${DEPENDENCY}/META-INF /app/META-INF
COPY --from="build" ${DEPENDENCY}/BOOT-INF/classes /app
USER spring:spring
# Run the Spring boot application
ENTRYPOINT ["java","-cp","app:app/lib/*","io.rrredbeard.kube_hello_app.KubeHelloApplication"]