-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
27 lines (24 loc) · 1016 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
## Stage 1 : unpack fat-jar
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime as builder
USER root
# Define build argument for version
ARG VERSION
# Use the build argument to specify the JAR file
COPY build/libs/techspec-agent-$VERSION.jar /deployments/app.jar
WORKDIR /deployments
RUN java -Djarmode=layertools -jar app.jar extract
# Ensure that the snapshot-dependencies folder is created even if there were no snapshot dependencies in the jar file (to avoid error when copying from that directory below)
RUN mkdir -p snapshot-dependencies
## Stage 2 : create image
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime
USER 185
WORKDIR /deployments
COPY --from=builder /deployments/dependencies/ ./
COPY --from=builder /deployments/snapshot-dependencies/ ./
COPY --from=builder /deployments/spring-boot-loader/ ./
COPY --from=builder /deployments/application/ ./
COPY config ./config
COPY agents ./agents
EXPOSE 8080
EXPOSE 9090
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]