Skip to content

Commit

Permalink
Simplify Dockerfile and move graalvm build to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
bn-nate committed Oct 14, 2022
1 parent c3a629a commit 2815238
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
34 changes: 10 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
27 changes: 27 additions & 0 deletions Dockerfile-graalvm-build
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 2815238

Please sign in to comment.