-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c792a76
commit 9887980
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use an appropriate base image with JDK 21 | ||
FROM openjdk:21-jdk-slim AS build | ||
|
||
WORKDIR /app | ||
|
||
# Copy the Maven wrapper and POM file | ||
COPY mvnw . | ||
COPY .mvn .mvn | ||
COPY pom.xml . | ||
|
||
# Install Maven dependencies | ||
RUN ./mvnw dependency:go-offline | ||
|
||
# Copy the source code | ||
COPY src ./src | ||
|
||
# Build the application | ||
RUN ./mvnw clean package -DskipTests | ||
|
||
# Use a smaller image for the runtime | ||
FROM openjdk:21-jdk-slim | ||
|
||
WORKDIR /app | ||
|
||
# Copy the built jar file from the build stage | ||
COPY --from=build /app/target/*.jar app.jar | ||
|
||
# Run the application | ||
ENTRYPOINT ["java", "-jar", "app.jar"] |