-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (29 loc) · 778 Bytes
/
Dockerfile
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
31
32
33
34
35
36
37
38
39
40
41
42
FROM eclipse-temurin:17-jdk-jammy as build
WORKDIR /build
COPY --chmod=0755 .mvn/mvnw.sh mvnw
COPY .mvn/ .mvn/
COPY pom.xml .
COPY ./src src/
RUN --mount=type=cache,target=/root/.m2 \
./mvnw clean install -DskipTests
FROM eclipse-temurin:17-jre-jammy as final
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
USER appuser
USER root
RUN apt-get update && apt-get install -y netcat
USER appuser
COPY --from=build /build/target/*.jar /app/app.jar
COPY src/main/docker/component/wait-for-db.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/wait-for-db.sh
USER appuser
EXPOSE 80
ENTRYPOINT ["java", "-jar", "/app/app.jar"]