-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (31 loc) · 1.2 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
FROM openjdk:17-jdk as build
WORKDIR /workspace/app
RUN microdnf install git
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
RUN ./mvnw validate
RUN ./mvnw dependency:copy-dependencies
# RUN ./mvnw dependency:go-offline
COPY src src
COPY api-spec api-spec
COPY eclipse-style.xml eclipse-style.xml
# COPY api-spec api-spec
RUN ./mvnw install -DskipTests # --offline
RUN mkdir target/extracted && java -Djarmode=layertools -jar target/*.jar extract --destination target/extracted
FROM openjdk:17-slim
RUN addgroup --system user && adduser --ingroup user --system user
USER user:user
WORKDIR /app/
ARG EXTRACTED=/workspace/app/target/extracted
# OpenTelemetry agent
ADD --chown=user https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/opentelemetry-javaagent.jar .
COPY --from=build --chown=user ${EXTRACTED}/dependencies/ ./
RUN true
COPY --from=build --chown=user ${EXTRACTED}/spring-boot-loader/ ./
RUN true
COPY --from=build --chown=user ${EXTRACTED}/snapshot-dependencies/ ./
RUN true
COPY --from=build --chown=user ${EXTRACTED}/application/ ./
RUN true
ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]