-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
41 lines (31 loc) · 1.03 KB
/
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
### Builder
FROM ghcr.io/graalvm/native-image:ol8-java17-22.3.3 AS build
# Install Maven
RUN microdnf update -y && \
microdnf install -y maven && \
microdnf clean all
# Receiving app version
ARG APP_VERSION=0.0.1
# Copy
WORKDIR /app
COPY pom.xml ./
COPY src ./src
COPY mvnw ./
COPY .mvn/wrapper/maven-wrapper.properties ./.mvn/wrapper/maven-wrapper.properties
# Setting app version
RUN mvn versions:set -DnewVersion=${APP_VERSION} -f pom.xml -DskipTests -Dtests.skip=true -Dskip.unit.tests=true && \
mvn versions:commit -f pom.xml -DskipTests -Dtests.skip=true -Dskip.unit.tests=true
# Build
RUN ./mvnw -Pnative native:compile
### Deployer
FROM gcr.io/distroless/java-base:nonroot AS deploy
ARG PORT=3001
# Copy
WORKDIR /app
COPY --from=build /app/target/nr-forest-client-api ./nr-forest-client-api
# User, port and health check
USER 1001
EXPOSE ${PORT}
HEALTHCHECK CMD curl -f http://localhost:${PORT}/actuator/health | grep '"status":"UP"'
# Startup
ENTRYPOINT ["/app/nr-forest-client-api","--spring.profiles.active=container"]