# Use a specific OpenJDK base image for the build stage FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app # Copy Gradle wrapper and project files COPY gradlew . COPY gradle gradle COPY build.gradle settings.gradle ./ COPY src src # Make gradlew executable RUN chmod +x gradlew # Build the application RUN ./gradlew bootJar --no-daemon # Runtime stage FROM eclipse-temurin:21-jre-alpine WORKDIR /app # Copy the built JAR file from the builder stage COPY --from=builder /app/build/libs/*.jar app.jar # Expose the port Spring Boot typically uses EXPOSE 8080 # Command to run the Spring Boot application ENTRYPOINT ["java", "-jar", "app.jar"]