-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 852 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 852 Bytes
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
30
FROM maven:3.9.9-eclipse-temurin-17 AS builder
WORKDIR /app
COPY pom.xml .
COPY src ./src
RUN mvn -DskipTests package -q && \
mkdir -p deps && \
cp target/*.jar deps/app.jar
FROM eclipse-temurin:17-jre
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends wget && \
rm -rf /var/lib/apt/lists/* && \
groupadd --system appgroup && \
useradd --system --gid appgroup appuser && \
chown -R appuser:appgroup /app
USER appuser
COPY --from=builder --chown=appuser:appgroup /app/deps/app.jar app.jar
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget -q --spider http://localhost:8080/actuator/health || exit 1
EXPOSE 8080
ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=75.0", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]