diff --git a/.dockerignore b/.dockerignore index f02b188..4d8c5ef 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,15 +1,8 @@ .git .github .idea -.mvn -src classes logs -target/* -!target/netneutrality.jar +target *.iml README.md -checkstyle.xml -mvnw -mvnw.cmd -pom.xml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2174419..94764e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,14 @@ +FROM eclipse-temurin:25-jdk AS build + +WORKDIR /build + +COPY .mvn .mvn +COPY mvnw pom.xml checkstyle.xml ./ +RUN chmod +x mvnw && ./mvnw -B -q dependency:go-offline + +COPY src src +RUN ./mvnw -B -q package -DskipTests + FROM eclipse-temurin:25-jre@sha256:ff82c74a630c08b417502c4c18189e62074edbb28eb1f2d31b799ac138c01058 RUN apt-get update && apt-get install -y --no-install-recommends netcat-openbsd curl && rm -rf /var/lib/apt/lists/* @@ -8,7 +19,7 @@ ARG API_PORT=9000 EXPOSE ${API_PORT} COPY startup.sh ./ -COPY target/netneutrality.jar ./ +COPY --from=build /build/target/netneutrality.jar ./ RUN ["chmod", "+x", "./startup.sh"] -CMD ["./startup.sh"] \ No newline at end of file +CMD ["./startup.sh"]