-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
16 lines (16 loc) · 773 Bytes
/
Dockerfile
File metadata and controls
16 lines (16 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# maven 3 as 3.... version maven is used in this project
FROM maven:3-eclipse-temurin as build
#Copies all files from your project directory on your machine into the container’s working directory
COPY . .
#Executes Maven inside the container.
#clean = deletes old build files.
#package = builds your Spring Boot application into a JAR file.
#-DskipTests = skips running tests (saves time in Docker builds).
#After this, your .jar file is created inside /target/ folder in the container.
RUN mvn clean package -DskipTests
#21 as jdk 21 is used in this project, lighter than maven so container will be lighter
FROM eclipse-temurin:21-alpine
COPY --from=build /target/*.jar test.jar
#same port as application.properties
EXPOSE 9090
ENTRYPOINT ["java","-jar","test.jar"]