-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfileNative
More file actions
53 lines (38 loc) · 1.3 KB
/
DockerfileNative
File metadata and controls
53 lines (38 loc) · 1.3 KB
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
43
44
45
46
47
48
49
50
51
52
53
# ---------- BUILD STAGE ----------
FROM ghcr.io/graalvm/native-image-community:25-ol9 AS builder
WORKDIR /build
# copy gradle wrapper
COPY gradlew .
COPY gradle gradle
RUN chmod +x gradlew
# copy gradle config first (for dependency cache)
COPY build.gradle settings.gradle gradle.properties ./
# download dependencies (cached layer)
# RUN ./gradlew dependencies --no-daemon
RUN --mount=type=cache,target=/root/.gradle \
./gradlew dependencies --no-daemon
# copy source code
COPY src src
# build native image
# RUN ./gradlew nativeCompile -x test \
# --no-daemon \
# --max-workers=2 \
# -Dorg.gradle.jvmargs="-Xmx3g"
RUN --mount=type=cache,target=/root/.gradle \
./gradlew nativeCompile -x test \
--no-daemon
# ---------- RUNTIME STAGE ----------
FROM oraclelinux:9-slim
WORKDIR /app
RUN microdnf update -y && \
microdnf install -y tzdata && \
microdnf clean all
COPY --from=builder /build/build/native/nativeCompile/api-service /app/api-service
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=3s --retries=3 --start-period=5s \
CMD ["/app/api-service", "--health-check"]
ENV TZ="Asia/Bangkok"
#"--spring.profiles.active=localdocker"
ENTRYPOINT ["/app/api-service", \
"-Duser.timezone=Asia/Bangkok", \
"--spring.config.additional-location=/usr/spring-data/env/"]