27 lines
573 B
Docker
27 lines
573 B
Docker
# Use a JDK base image for building
|
|
FROM gradle:8.10.2-jdk17-alpine AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy build files
|
|
COPY build.gradle.kts settings.gradle.kts ./
|
|
COPY src ./src
|
|
|
|
# Build the application
|
|
RUN gradle build --no-daemon
|
|
|
|
# Use a lightweight JRE image for running
|
|
FROM eclipse-temurin:21-jre
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy the built JAR from the builder stage
|
|
COPY --from=builder /app/build/libs/*.jar app.jar
|
|
|
|
# Expose the port (default for Spring Boot)
|
|
EXPOSE 8080
|
|
|
|
# Run the application
|
|
ENTRYPOINT ["java", "-jar", "app.jar"] |