-
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
Showing
4 changed files
with
50 additions
and
4 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,34 @@ | ||
# Base Image: Use the official OpenJDK image with a specific Java version (adjust as needed) | ||
FROM maven:3.9.7-amazoncorretto-21 AS build | ||
|
||
# Environment Variables | ||
ENV APP_HOME=/app | ||
ENV PORT=8080 | ||
|
||
# Set Working Directory for Build | ||
WORKDIR $APP_HOME | ||
|
||
# Copy Project Files | ||
COPY . . | ||
|
||
# Build the Application using Maven | ||
RUN mvn package -DskipTests | ||
|
||
|
||
# Runtime Image | ||
FROM amazoncorretto:21-alpine-jdk | ||
|
||
# Environment Variables | ||
ENV APP_HOME=/app | ||
|
||
# Create App Directory (If Needed) | ||
WORKDIR $APP_HOME | ||
|
||
# Copy the JAR from the Build Stage (target folder) | ||
COPY --from=build $APP_HOME/target/app-1.0.jar app.jar | ||
|
||
# Expose Port | ||
EXPOSE $PORT | ||
|
||
# Run the Application | ||
ENTRYPOINT ["java","-jar","/app/app.jar"] |
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
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
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