-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (27 loc) · 986 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
# Example of custom Java runtime using jlink in a multi-stage container build
FROM eclipse-temurin:11 as jre-build
# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
--add-modules java.base \
--add-modules java.logging \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime
# Stage 1: Build stage
FROM gradle:7-jdk11 AS build
WORKDIR /workdir
COPY . .
RUN gradle fatJar
# Stage 2: Runtime stage
# Needs to be a recent ish debian image to have a new enough
# libc. Still haven't understood the finer points here.
FROM debian:bookworm-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME
WORKDIR /app
COPY --from=build /workdir/build/libs/deskriptor-1.0-SNAPSHOT-standalone.jar /app/
COPY logging.properties /logging.properties
ENTRYPOINT [ "java", "-jar", "/app/deskriptor-1.0-SNAPSHOT-standalone.jar" ]