-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 892 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 892 Bytes
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
### Start of builder image
FROM openjdk:17-alpine as builder
# Set working dir inside the build image
WORKDIR temp
# Could be set to different jar file location
ARG JAR_FILE=target/*.jar
# Copy fat jar file to current image builder
COPY ${JAR_FILE} application.jar
# Extract the jar file layers
RUN java -Djarmode=layertools -jar application.jar extract
#### Start of app image
FROM openjdk:17-alpine
# Set working dir inside the app image
WORKDIR app
# Copy all layers from builder stage to current image
COPY --from=builder temp/dependencies/ ./
COPY --from=builder temp/snapshot-dependencies/ ./
COPY --from=builder temp/spring-boot-loader/ ./
COPY --from=builder temp/application/ ./
# Expose current application to port 8080
EXPOSE 8080
# Run the application with JVM configs if any
ENTRYPOINT ["sh", "-c", "java -server org.springframework.boot.loader.JarLauncher ${0} ${@}"]