18
18
# License along with this library; if not, write to the Free Software
19
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
#
21
- # NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22
- # The original license header is included below.
23
- #
24
- # =====================================================================
25
- #
26
- # eXist-db Open Source Native XML Database
27
- # Copyright (C) 2001 The eXist-db Authors
28
- #
29
-
30
- # http://www.exist-db.org
31
- #
32
- # This library is free software; you can redistribute it and/or
33
- # modify it under the terms of the GNU Lesser General Public
34
- # License as published by the Free Software Foundation; either
35
- # version 2.1 of the License, or (at your option) any later version.
36
- #
37
- # This library is distributed in the hope that it will be useful,
38
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
39
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40
- # Lesser General Public License for more details.
41
- #
42
- # You should have received a copy of the GNU Lesser General Public
43
- # License along with this library; if not, write to the Free Software
44
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
45
- #
46
21
47
- # Install latest JRE 8 in Debian Stretch (which is the base of gcr.io/distroless/java:8)
48
- FROM debian:stretch-slim as updated-jre
49
- RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
50
- RUN echo "deb http://archive.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
51
- RUN apt-get update && apt-get -y dist-upgrade
52
- RUN apt-get install -y openjdk-8-jre-headless
53
- RUN apt-get install -y expat fontconfig # Install tools required by FOP
54
-
55
- FROM gcr.io/distroless/java:8
56
-
57
- # Copy over updated JRE from Debian Stretch
58
- COPY --from=updated-jre /etc/java-8-openjdk /etc/java-8-openjdk
59
- COPY --from=updated-jre /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-openjdk-amd64
60
- COPY --from=updated-jre /usr/share/gdb/auto-load/usr/lib/jvm/java-8-openjdk-amd64 /usr/share/gdb/auto-load/usr/lib/jvm/java-8-openjdk-amd64
61
-
62
- # Copy over dependencies for Apache FOP, missing from GCR's JRE
63
- COPY --from=updated-jre /usr/lib/x86_64-linux-gnu/libfreetype.so.6 /usr/lib/x86_64-linux-gnu/libfreetype.so.6
64
- COPY --from=updated-jre /usr/lib/x86_64-linux-gnu/liblcms2.so.2 /usr/lib/x86_64-linux-gnu/liblcms2.so.2
65
- COPY --from=updated-jre /usr/lib/x86_64-linux-gnu/libpng16.so.16 /usr/lib/x86_64-linux-gnu/libpng16.so.16
66
- COPY --from=updated-jre /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
67
-
68
- # Copy dependencies for Apache Batik (used by Apache FOP to handle SVG rendering)
69
- COPY --from=updated-jre /etc/fonts /etc/fonts
70
- COPY --from=updated-jre /lib/x86_64-linux-gnu/libexpat.so.1 /lib/x86_64-linux-gnu/libexpat.so.1
71
- COPY --from=updated-jre /usr/share/fontconfig /usr/share/fontconfig
72
- COPY --from=updated-jre /usr/share/fonts/truetype/dejavu /usr/share/fonts/truetype/dejavu
22
+ # Install latest JRE 8 in Chainguard Wolfi temporary builder image
23
+ FROM cgr.dev/chainguard/wolfi-base AS builder
24
+
25
+ RUN apk update && apk upgrade
26
+ # Install dependencies needed for JRE
27
+ RUN apk add zlib libjpeg-turbo libpng lcms2 freetype ttf-dejavu fontconfig-config libfontconfig1 expat libuuid libbrotlicommon1 libbrotlidec1 libbrotlienc1 libcrypt1
28
+ # Install latest JRE
29
+ RUN apk add openjdk-8-jre
30
+
31
+ # Use Chainguard distroless glibc base for dynamically linked libraries
32
+ FROM cgr.dev/chainguard/glibc-dynamic:latest
33
+
34
+ # Copy over dependencies for updated JRE from Wolfi
35
+ COPY --from=builder /etc/ca-certificates /etc/ca-certificates
36
+ COPY --from=builder /etc/ca-certificates.conf /etc/ca-certificates.conf
37
+ COPY --from=builder /lib/libz.so.1 /lib/libz.so.1
38
+ COPY --from=builder /usr/lib/libjpeg.so.8 /usr/lib/libjpeg.so.8
39
+ COPY --from=builder /usr/lib/libturbojpeg.so.0 /usr/lib/libturbojpeg.so.0
40
+ COPY --from=builder /usr/lib/libpng16.so.16 /usr/lib/libpng16.so.16
41
+ COPY --from=builder /usr/lib/liblcms2.so.2 /usr/lib/liblcms2.so.2
42
+ COPY --from=builder /usr/lib/libfreetype.so.6 /usr/lib/libfreetype.so.6
43
+ COPY --from=builder /usr/share/fonts /usr/share/fonts
44
+ COPY --from=builder /etc/fonts /etc/fonts
45
+ COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
46
+ COPY --from=builder /usr/share/gettext /usr/share/gettext
47
+ COPY --from=builder /usr/share/xml /usr/share/xml
48
+ COPY --from=builder /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so.1
49
+ COPY --from=builder /usr/lib/libexpat.so.1 /usr/lib/libexpat.so.1
50
+ COPY --from=builder /usr/lib/libuuid.so.1 /usr/lib/libuuid.so.1
51
+ COPY --from=builder /usr/lib/libbrotlicommon.so.1 /usr/lib/libbrotlicommon.so.1
52
+ COPY --from=builder /usr/lib/libbrotlidec.so.1 /usr/lib/libbrotlidec.so.1
53
+ COPY --from=builder /usr/lib/libbrotlienc.so.1 /usr/lib/libbrotlienc.so.1
54
+
55
+ # Copy over updated JRE from Wolfi
56
+ COPY --from=builder /usr/lib/jvm/java-1.8-openjdk /usr/lib/jvm/java-1.8-openjdk
57
+
58
+ # Switch to nonroot user
59
+ USER nonroot
73
60
74
61
# Copy Elemental
75
62
COPY LICENSE /elemental/LICENSE
76
63
COPY autodeploy /elemental/autodeploy
77
64
COPY etc /elemental/etc
78
65
COPY lib /elemental/lib
79
- COPY logs /elemental/logs
80
-
66
+ COPY --chown=nonroot logs /elemental/logs
67
+ COPY --chown=nonroot logs /elemental/data
81
68
82
69
# Build-time metadata as defined at http://label-schema.org
83
70
# and used by autobuilder @hooks/build
@@ -97,26 +84,15 @@ ARG CACHE_MEM
97
84
ARG MAX_BROKER
98
85
ARG JVM_MAX_RAM_PERCENTAGE
99
86
100
- ENV ELEMENTAL_HOME "/elemental"
101
- ENV EXIST_HOME "/elemental"
102
- ENV CLASSPATH=/elemental/lib/${elemental.uber.jar.filename}
103
-
104
- ENV JAVA_TOOL_OPTIONS \
105
- -Dfile.encoding=UTF8 \
106
- -Dsun.jnu.encoding=UTF-8 \
107
- -Djava.awt.headless=true \
108
- -Dorg.exist.db-connection.cacheSize=${CACHE_MEM:-256}M \
109
- -Dorg.exist.db-connection.pool.max=${MAX_BROKER:-20} \
110
- -Dlog4j.configurationFile=/elemental/etc/log4j2.xml \
111
- -Dexist.home=/elemental \
112
- -Dexist.configurationFile=/elemental/etc/conf.xml \
113
- -Djetty.home=/elemental \
114
- -Dexist.jetty.config=/elemental/etc/jetty/standard.enabled-jetty-configs \
115
- -XX:+UseG1GC \
116
- -XX:+UseStringDeduplication \
117
- -XX:+UseContainerSupport \
118
- -XX:MaxRAMPercentage=${JVM_MAX_RAM_PERCENTAGE:-75.0} \
119
- -XX:+ExitOnOutOfMemoryError
87
+ ENV ELEMENTAL_HOME="/elemental"
88
+ ENV EXIST_HOME="/elemental"
89
+ ENV CLASSPATH="/elemental/lib/${elemental.uber.jar.filename}"
90
+
91
+ ENV JAVA_HOME="/usr/lib/jvm/java-1.8-openjdk"
92
+
93
+ ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8 -Dsun.jnu.encoding=UTF-8 -Djava.awt.headless=true -Dorg.exist.db-connection.cacheSize=${CACHE_MEM:-256}M -Dorg.exist.db-connection.pool.max=${MAX_BROKER:-20} -Dlog4j.configurationFile=/elemental/etc/log4j2.xml -Dexist.home=/elemental -Dexist.configurationFile=/elemental/etc/conf.xml -Djetty.home=/elemental -Dexist.jetty.config=/elemental/etc/jetty/standard.enabled-jetty-configs -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseContainerSupport -XX:MaxRAMPercentage=${JVM_MAX_RAM_PERCENTAGE:-75.0} -XX:+ExitOnOutOfMemoryError"
94
+
95
+ ENV PATH="/usr/lib/jvm/java-1.8-openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
120
96
121
97
HEALTHCHECK CMD [ "java" , \
122
98
"org.exist.start.Main" , "client" , \
0 commit comments