Skip to content

Commit 6966c02

Browse files
product-service-docker: docker compose
1 parent b408bfe commit 6966c02

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Build argument for Java version
2+
ARG JAVA_VERSION=21
3+
4+
# Stage 1: Build the application
5+
FROM maven:3.9.4 AS builder
6+
WORKDIR /app
7+
COPY pom.xml .
8+
COPY src ./src
9+
RUN mvn clean package
10+
11+
# Stage 2: Run the application
12+
FROM openjdk:${JAVA_VERSION}-jdk-slim
13+
WORKDIR /app
14+
COPY --from=builder /app/target/product-service.jar app.jar
15+
EXPOSE 8080
16+
ENTRYPOINT ["java", "-jar", "app.jar"]

0 commit comments

Comments
 (0)