Skip to content

Instantly share code, notes, and snippets.

@nebhale
Last active September 3, 2020 02:07
Show Gist options
  • Save nebhale/00dec9db288a2ee50be96b400c46db0f to your computer and use it in GitHub Desktop.
Save nebhale/00dec9db288a2ee50be96b400c46db0f to your computer and use it in GitHub Desktop.
# Download and verify file
# Args: $DOWNLOAD_URI, $SHA256
FROM ubuntu:bionic AS retrieve
RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
ARG DOWNLOAD_URI
RUN curl -L \
$DOWNLOAD_URI \
> download.tar.gz
ARG SHA256
RUN echo "${SHA256} download.tar.gz" | sha256sum -c - 2>&1
# Install File
FROM ubuntu:bionic
ENV JAVA_HOME /usr/lib/jvm/jre
ENV PATH $JAVA_HOME/bin:$PATH
COPY --from=retrieve download.tar.gz /tmp/download.tar.gz
RUN mkdir -p /usr/lib/jvm \
&& tar xzf /tmp/download.tar.gz -C /usr/lib/jvm \
&& ln -s /usr/lib/jvm/* /usr/lib/jvm/jre \
&& rm /tmp/download.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment