From 1d7e7e2fe5f982399e9ff4f9432c47e0a5d88af2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-E7L6HLO\\Noyan" Date: Fri, 19 Jul 2024 09:53:41 +0300 Subject: [PATCH] Task 46 : Implement Dockerfile in user service --- userservice/Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 userservice/Dockerfile diff --git a/userservice/Dockerfile b/userservice/Dockerfile new file mode 100644 index 0000000..d724089 --- /dev/null +++ b/userservice/Dockerfile @@ -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"] \ No newline at end of file