From 17da8dd44df6f02a5f1ee2367b618ecc57e4655c Mon Sep 17 00:00:00 2001 From: Jakub Knetl Date: Fri, 6 Sep 2024 09:41:08 +0200 Subject: [PATCH] Add Dockerfile --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8b64a13 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# First stage: Build the application +FROM gradle:8.8 AS build + +# Set the working directory +WORKDIR /app + +# Copy the Gradle wrapper and build files +COPY gradlew . +COPY gradle gradle +COPY build.gradle.kts . +COPY settings.gradle.kts . + +# Copy the source code +COPY src src + +# Build the application +RUN ./gradlew build + +# Second stage: Create the runtime image +FROM openjdk:21-jdk-slim + +# Set the working directory +WORKDIR /app + +# Copy the build artifacts from the first stage +COPY --from=build /app/build/libs/*.jar app.jar + +# Expose the port the application runs on +EXPOSE 8080 + +# Specify the command to run the application +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file