diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..fb931ac --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,32 @@ +# Use a base image with Java 17 +FROM openjdk:17-jdk-slim AS build + +# Set the working directory in the container +WORKDIR /app + +# Copy Gradle wrapper and configuration files +COPY gradlew . +COPY gradle/ gradle/ +COPY build.gradle . +COPY settings.gradle . + +# Copy the source code +COPY src/ src/ + +# Make Gradle wrapper executable and build the application +RUN ./gradlew build + +# Use a smaller runtime image for the final build +FROM openjdk:17-jdk-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the built application from the build stage +COPY --from=build /app/build/libs/*.jar app.jar + +# Expose port 8080 +EXPOSE 8080 + +# Run the application +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file