diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 324d0b4..0000000 --- a/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM eclipse-temurin:17-jdk-alpine - -WORKDIR /app - -# Only copy the JAR if it exists -COPY ./target/concore-*.jar /app/concore.jar - -# Ensure the JAR file is executable if present -RUN [ -f /app/concore.jar ] && chmod +x /app/concore.jar || true - -EXPOSE 3000 - -# Run Java app only if the JAR exists, otherwise do nothing -CMD ["/bin/sh", "-c", "if [ -f /app/concore.jar ]; then java -jar /app/concore.jar; else echo 'No Java application found, exiting'; fi"] diff --git a/Dockerfile.java b/Dockerfile.java new file mode 100644 index 0000000..a3eb3ad --- /dev/null +++ b/Dockerfile.java @@ -0,0 +1,17 @@ +#build stage +FROM maven:3.9-eclipse-temurin-17-alpine AS builder +WORKDIR /build +COPY pom.xml . +RUN mvn dependency:go-offline -B +COPY src ./src +RUN mvn clean package -DskipTests + +#runtime stage +FROM eclipse-temurin:17-jdk-alpine + +WORKDIR /app + +# Copy the JAR from the build stage +COPY --from=builder /build/target/concore-*.jar /app/concore.jar +EXPOSE 3000 +CMD ["java", "-jar", "/app/concore.jar"] \ No newline at end of file