Add Dockerfile

This commit is contained in:
2024-09-06 09:41:08 +02:00
parent 2d8cc727c4
commit 17da8dd44d

32
Dockerfile Normal file
View File

@@ -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"]