File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,20 @@ ARG JAVA_VERSION=21
4
4
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS jre-base
5
5
6
6
7
+ # Force upgrade to get rid of CVEs
8
+ # See also https://stackoverflow.com/a/76440791
9
+ FROM alpine:3 AS alpine-upgraded
10
+
11
+ RUN apk upgrade --no-cache
12
+
13
+
7
14
# Build the JRE ourself and exclude stuff from Eclipse-Temurin that we don't need
8
15
#
9
16
# Derived from https://github.com/adoptium/containers/blob/91ea190c462741d2c64ed2f8f0a0efdb3e77c49d/21/jre/alpine/3.21/Dockerfile
10
- FROM alpine:3 AS jre-minimized
17
+ FROM scratch AS jre-minimized
18
+
19
+ COPY --from=alpine-upgraded / /
20
+ CMD ["/bin/sh" ]
11
21
12
22
ENV JAVA_HOME=/opt/java/openjdk
13
23
ENV PATH=$JAVA_HOME/bin:$PATH
Original file line number Diff line number Diff line change @@ -4,10 +4,20 @@ ARG JAVA_VERSION=21
4
4
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS jre-base
5
5
6
6
7
+ # Force upgrade to get rid of CVEs
8
+ # See also https://stackoverflow.com/a/76440791
9
+ FROM alpine:3 AS alpine-upgraded
10
+
11
+ RUN apk upgrade --no-cache
12
+
13
+
7
14
# Build the JRE ourself and exclude stuff from Eclipse-Temurin that we don't need
8
15
#
9
16
# Derived from https://github.com/adoptium/containers/blob/91ea190c462741d2c64ed2f8f0a0efdb3e77c49d/21/jre/alpine/3.21/Dockerfile
10
- FROM alpine:3 AS jre-minimized
17
+ FROM scratch AS jre-minimized
18
+
19
+ COPY --from=alpine-upgraded / /
20
+ CMD ["/bin/sh" ]
11
21
12
22
ENV JAVA_HOME=/opt/java/openjdk
13
23
ENV PATH=$JAVA_HOME/bin:$PATH
You can’t perform that action at this time.
0 commit comments