summaryrefslogtreecommitdiffstats
path: root/docker/Dockerfile
blob: 1485e95be2fc0c9c76dfe61e6cf1b1ca8ed73cd8 (plain) (blame)
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
# SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
#
# SPDX-License-Identifier: EPL-2.0

FROM docker.io/eclipse-temurin:17-jammy AS jlink
# Disable HotSpot C1 compilation, because it causes spurious
# NullPointerException instances to be thrown when running in
# qemu-aarch64-static for image cross-building.
ENV _JAVA_OPTIONS="-XX:CompilationMode=high-only"
# We need to manually add jdk.zipfs to the list of modules output by jdeps to
# enable serving static assets from the refinery-language-web-VERSION.jar,
# because the dependency doesn't get picked up by static analysis.
RUN jlink --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules \
    java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.rmi,java.security.jgss,java.sql,jdk.unsupported,jdk.zipfs \
    --output /jlink

FROM docker.io/debian:12-slim AS base
# The first layer contains the slimmed down JRE.
COPY --link --from=jlink /jlink /usr/lib/java
ENV JAVA_HOME="/usr/lib/java" PATH="/usr/lib/java/bin:${PATH}"
# Layer with platform-independent dependencies, slow changing.
ADD --link lib /app/lib

FROM base AS refinery-amd64
# Layer with platform-dependent dependencies, slow changing.
ADD --link lib_amd64 /app/lib
# Layer with platform-dependent startup script containing references to all
# dependency version.
ADD --link app_amd64_bin /app/bin

FROM base AS refinery-arm64
# Layer with platform-dependent dependencies, slow changing.
ADD --link lib_arm64 /app/lib
# Layer with platform-dependent startup script containing references to all
# dependency version.
ADD --link app_arm64_bin /app/bin

FROM refinery-$TARGETARCH
# Layer with platform-independent application jars.
ADD --link app_lib /app/lib
# Common settings added on top.
ENV REFINERY_LISTEN_HOST=0.0.0.0 REFINERY_LISTEN_PORT=8888
EXPOSE 8888
USER 1000
WORKDIR /app
ENTRYPOINT /app/bin/refinery-language-web