From 2815238470909571f00fc45a8aded6d170a71980 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Fri, 14 Oct 2022 10:18:29 -0700 Subject: [PATCH] Simplify Dockerfile and move graalvm build to separate file --- Dockerfile | 34 ++++++++++------------------------ Dockerfile-graalvm-build | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 Dockerfile-graalvm-build diff --git a/Dockerfile b/Dockerfile index 35c4573..564f2cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,15 @@ -# this dockerfile and the associated compilation steps are -# highly inspired by babashka's compilation process. -# -# See below for more details: -# https://github.com/babashka/babashka -FROM clojure:openjdk-11-lein-2.9.6-bullseye AS BASE - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt update -RUN apt install --no-install-recommends -yy curl unzip build-essential zlib1g-dev sudo -WORKDIR "/opt" -RUN curl -sLO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz -RUN tar -xzf graalvm-ce-java11-linux-amd64-21.1.0.tar.gz +FROM ubuntu:latest +WORKDIR /app -ENV GRAALVM_HOME="/opt/graalvm-ce-java11-21.1.0" -ENV JAVA_HOME="/opt/graalvm-ce-java11-21.1.0/bin" -ENV PATH="$JAVA_HOME:$PATH" -ENV IS_STATIC="true" -ENV USE_MUSL="true" +RUN apt update && \ + apt install --no-install-recommends -yy curl unzip ca-certificates -COPY . . -RUN ./script/setup-musl -RUN ./script/uberjar -RUN ./script/compile +ARG LH_VERSION +RUN test -n "$LH_VERSION" && \ + curl -sLO https://github.com/barracudanetworks/lighthouse/releases/download/$LH_VERSION/lighthouse-native-linux-amd64.zip && \ + unzip lighthouse-native-linux-amd64.zip && \ + mv lh /usr/local/bin && \ + rm lighthouse-native-linux-amd64.zip -FROM ubuntu:latest -COPY --from=BASE /opt/lh /usr/local/bin/lh ENTRYPOINT ["lh"] CMD ["--help"] diff --git a/Dockerfile-graalvm-build b/Dockerfile-graalvm-build new file mode 100644 index 0000000..80e965b --- /dev/null +++ b/Dockerfile-graalvm-build @@ -0,0 +1,27 @@ +# this dockerfile and the associated compilation steps are +# highly inspired by babashka's compilation process. +# +# See below for more details: +# https://github.com/babashka/babashka +FROM clojure:openjdk-11-lein-2.9.6-bullseye AS BASE + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update +RUN apt install --no-install-recommends -yy curl unzip build-essential zlib1g-dev sudo +WORKDIR "/opt" +RUN curl -sLO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz +RUN tar -xzf graalvm-ce-java11-linux-amd64-21.1.0.tar.gz + +ENV GRAALVM_HOME="/opt/graalvm-ce-java11-21.1.0" +ENV JAVA_HOME="/opt/graalvm-ce-java11-21.1.0/bin" +ENV PATH="$JAVA_HOME:$PATH" +ENV IS_STATIC="true" + +COPY . . +RUN ./script/uberjar +RUN ./script/compile + +FROM ubuntu:latest +COPY --from=BASE /opt/lh /usr/local/bin/lh +ENTRYPOINT ["lh"] +CMD ["--help"]