Skip to content

Commit

Permalink
Task 46 : Implement Dockerfile in user service
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapter1990 committed Jul 19, 2024
1 parent 824fecd commit 1d7e7e2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions userservice/Dockerfile
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"]

0 comments on commit 1d7e7e2

Please sign in to comment.