-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (39 loc) · 1.64 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
ARG JAVA_VERSION=8u332b09
ARG JAVA_VERSION_URL=jdk8u332-b09
ARG JAVA_SYMLINK_NAME=jre-8
ARG JAVA_SHA256_CHECKSUM=34454309b43d585047baaefc36c1850d0192cccc8b52cdc4aadb192b8e3e4c81
# =============================================================================
# ========== Download JRE
# =============================================================================
FROM kristinjeanna/ubuntu:v1.1.0 AS jre-downloader
USER root
# JRE8 args
ARG JAVA_VERSION
ARG JAVA_VERSION_URL
ARG JAVA_RELEASE_URL=https://github.com/adoptium/temurin8-binaries/releases/download/${JAVA_VERSION_URL}
ARG JAVA_FILENAME=OpenJDK8U-jre_x64_linux_hotspot_${JAVA_VERSION}.tar.gz
ARG JAVA_EXTRACT_DIR=jre${JAVA_VERSION}
ARG JAVA_SHA256_CHECKSUM
ARG JAVA_SYMLINK_NAME
# download JRE8, verify hash, and extract
RUN mkdir /opt/${JAVA_EXTRACT_DIR} && \
cd /opt && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wget && \
wget ${JAVA_RELEASE_URL}/${JAVA_FILENAME} && \
echo "${JAVA_SHA256_CHECKSUM} ${JAVA_FILENAME}" | sha256sum -c - && \
tar -xzv -C ${JAVA_EXTRACT_DIR} -f ${JAVA_FILENAME} --strip-components=1 && \
ln -s ${JAVA_EXTRACT_DIR} ${JAVA_SYMLINK_NAME} && \
rm ${JAVA_FILENAME}
# =============================================================================
# ========== Assemble the final docker image
# =============================================================================
FROM kristinjeanna/ubuntu:v1.1.0 AS final
ARG JAVA_VERSION
ARG JAVA_SYMLINK_NAME
LABEL "java.version"="${JAVA_VERSION}"
ENV JAVA_HOME=/opt/${JAVA_SYMLINK_NAME}
ENV PATH=${JAVA_HOME}/bin:${PATH}
# copy the downloaded Java JRE
COPY --from=jre-downloader /opt /opt
CMD ["bash"]