-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile-native
More file actions
57 lines (44 loc) · 1.52 KB
/
Dockerfile-native
File metadata and controls
57 lines (44 loc) · 1.52 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
54
55
56
57
FROM container-registry.oracle.com/graalvm/native-image:25 AS build
# Red Hat Enterprise Linux release 10.0 (CentOS Stream)
RUN microdnf install -y maven
WORKDIR /app
# create runtime user
RUN useradd \
--home-dir /nonexistent \
--shell /sbin/nologin \
--uid 65532 \
--no-create-home \
reservoir
# Needed for git-commit-id-plugin
COPY .git/ .git
# Reamining files are copied for building the native image
COPY pom.xml .
COPY checkstyle/ checkstyle
COPY descriptors/ descriptors
COPY js/ js
COPY server/ server
COPY util/ util
COPY xsl/ xsl
# Native image build runs tests which uses testcontainers.
# So we have to build on host before building the image.
# RUN --mount=type=cache,sharing=shared,target=/root/.m2/repository mvn -B -DskipTests -Pnative package
# Save list of shared lib deps
RUN ldd server/target/reservoir-native | tr -s '[:blank:]' '\n' | grep '^/' | \
xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;'
RUN mkdir -p /app/tmp/vertx-cache
RUN chown -R reservoir:reservoir /app/tmp
FROM scratch
# user, group, and timezone data
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /etc/group /etc/group
COPY --from=build --chown=reservoir:reservoir /app/tmp /tmp
COPY --from=build /app/server/target/reservoir-native /reservoir-native
COPY --from=build /app/deps /
EXPOSE 8081
USER reservoir:reservoir
#TODO scratch does not have a shell
#there's no way to pass HTTP_PORT env from the chart
ENTRYPOINT ["/reservoir-native"]
# Handle SIGTERM
CMD []