Spaces:
Sleeping
Sleeping
File size: 635 Bytes
bb5169d 0aeaf96 bb5169d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# -------- Stage 1: Build the Spring Boot application --------
FROM maven:3.9.6-eclipse-temurin-21 AS build
# Create a working directory
WORKDIR /app
# Copy the Maven project files
COPY pom.xml .
COPY src ./src
# Build the project (skip tests to speed up)
RUN mvn clean package -DskipTests
# -------- Stage 2: Create a lightweight runtime image --------
FROM openjdk:21-jdk
# Set working directory in runtime container
WORKDIR /app
# Copy the built jar file from the build stage
COPY --from=build /app/target/*.jar app.jar
# Expose the Spring Boot default port
EXPOSE 7860
# Run the app
ENTRYPOINT ["java", "-jar", "app.jar"]
|