From 018017044260158de083c13f64c653589a8958eb Mon Sep 17 00:00:00 2001 From: David Rabko Date: Mon, 15 Apr 2024 09:37:31 +0200 Subject: [PATCH 1/2] Add Dockerfile --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f1fb157 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:17-jdk-slim +MAINTAINER daverbk, RomanMager +COPY build/libs/*.jar app.jar +ENTRYPOINT ["java","-jar","/app.jar"] From 6d8703894b87c77d7489546dd2fb86ad1c7c6dbf Mon Sep 17 00:00:00 2001 From: Roman Mager Date: Mon, 29 Jul 2024 21:32:03 +0300 Subject: [PATCH 2/2] Update Dockerfile to implement multistage build --- Dockerfile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f1fb157..37d76fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,17 @@ +FROM gradle:8-jdk17-jammy AS build +WORKDIR /app +COPY settings.gradle.kts ./ +COPY build.gradle.kts ./ +COPY ./src ./src +RUN gradle build --no-daemon -x test + FROM openjdk:17-jdk-slim MAINTAINER daverbk, RomanMager -COPY build/libs/*.jar app.jar -ENTRYPOINT ["java","-jar","/app.jar"] +WORKDIR /app +COPY --from=build /app/build/libs/*.jar app.jar + +RUN useradd -m ypm-user +USER ypm-user + +EXPOSE 8080 +ENTRYPOINT ["sh", "-c", "java -jar /app/app.jar"]