-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Task 46 : Implement Dockerfile in user service
- Loading branch information
1 parent
824fecd
commit 1d7e7e2
Showing
1 changed file
with
27 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,27 @@ | ||
# Stage 1: Build stage | ||
FROM maven:3.9.7-amazoncorretto-21 AS build | ||
|
||
# Copy Maven files for dependency resolution | ||
COPY pom.xml ./ | ||
COPY .mvn .mvn | ||
|
||
# Copy application source code | ||
COPY src src | ||
|
||
# Build the project and create the executable JAR | ||
RUN mvn clean install -DskipTests | ||
|
||
# Stage 2: Run stage | ||
FROM amazoncorretto:21 | ||
|
||
# Set working directory | ||
WORKDIR userservice | ||
|
||
# Copy the JAR file from the build stage | ||
COPY --from=build target/*.jar userservice.jar | ||
|
||
# Expose port 1113 | ||
EXPOSE 1113 | ||
|
||
# Set the entrypoint command for running the application | ||
ENTRYPOINT ["java", "-jar", "userservice.jar"] |