Skip to content

Commit f9455c5

Browse files
committed
update java docker file to two stage build
1 parent bee46ba commit f9455c5

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

Dockerfile.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#build stage
2+
FROM maven:3.9-eclipse-temurin-17-alpine AS builder
3+
WORKDIR /build
4+
COPY pom.xml .
5+
RUN mvn dependency:go-offline -B
6+
COPY src ./src
7+
RUN mvn clean package -DskipTests
8+
9+
#runtime stage
10+
FROM eclipse-temurin:17-jdk-alpine
11+
12+
WORKDIR /app
13+
14+
# Copy the JAR from the build stage
15+
COPY --from=builder /build/target/concore-*.jar /app/concore.jar
16+
EXPOSE 3000
17+
CMD ["java", "-jar", "/app/concore.jar"]

0 commit comments

Comments
 (0)