forked from mtusi2026/mtusi2026lab3
lab3
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
FROM maven:3.9.9-eclipse-temurin-21 AS builder
|
||||
WORKDIR /build
|
||||
|
||||
COPY java/pom.xml .
|
||||
RUN mvn -B -q dependency:go-offline
|
||||
|
||||
|
||||
COPY java/src ./src
|
||||
RUN mvn -B -q clean package -DskipTests
|
||||
|
||||
FROM eclipse-temurin:21-jre-alpine AS runtime
|
||||
|
||||
RUN addgroup -g 1001 -S appgroup \
|
||||
&& adduser -u 1001 -S appuser -G appgroup
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/target/*.jar app.jar
|
||||
RUN chown -R appuser:appgroup /app
|
||||
|
||||
USER appuser
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD wget -qO- http://localhost:8080/health/live || exit 1
|
||||
|
||||
ENTRYPOINT ["java", "-XX:MaxRAMPercentage=75.0", "-jar", "/app/app.jar"]
|
||||
Reference in New Issue
Block a user