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