Spaces:
Sleeping
Sleeping
KevanSoon
commited on
Commit
·
b10c8c6
1
Parent(s):
d471d68
java dockerfile
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Build Spring Boot app with Maven
|
| 2 |
+
FROM maven:3.9.6-eclipse-temurin-17 AS build
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Copy project files
|
| 6 |
+
COPY pom.xml .
|
| 7 |
+
COPY src ./src
|
| 8 |
+
|
| 9 |
+
# Build the Spring Boot JAR (skip tests to save time)
|
| 10 |
+
RUN mvn clean package -DskipTests
|
| 11 |
+
|
| 12 |
+
# Stage 2: Run the app
|
| 13 |
+
FROM openjdk:17-jdk-slim
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copy the JAR from the build stage
|
| 17 |
+
COPY --from=build /app/target/*.jar app.jar
|
| 18 |
+
|
| 19 |
+
# Hugging Face Spaces requires exposing port 7860
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
# Run Spring Boot on port 7860
|
| 23 |
+
ENTRYPOINT ["java","-jar","app.jar","--server.port=7860"]
|