Skip to content

Commit

Permalink
smaller multistage builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Aug 12, 2024
1 parent 9694197 commit 68eb1f2
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM eclipse-temurin:17-jdk-jammy as build
FROM python:3.9.7-slim AS build

RUN apt-get -y update && apt-get install -y apt-utils && \
apt-get install -y -qq -o=Dpkg::Use-Pty=0 build-essential gfortran zlib1g-dev \
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip && \
apt-get install -q -y --no-install-recommends curl dnsutils
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip

COPY . /vcellroot

Expand All @@ -27,12 +26,7 @@ RUN /usr/bin/cmake \
make && \
ctest -VV

FROM eclipse-temurin:17-jdk-jammy as runtime

RUN apt-get -y update && apt-get install -y apt-utils && \
apt-get install -y -qq -o=Dpkg::Use-Pty=0 build-essential gfortran zlib1g-dev \
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip && \
apt-get install -q -y --no-install-recommends curl dnsutils
FROM eclipse-temurin:17 AS jre-build

# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
Expand All @@ -43,12 +37,23 @@ RUN $JAVA_HOME/bin/jlink \
--compress=2 \
--output /javaruntime

ENV JAVA_HOME=/javaruntime
# Define base image and copy in jlink created minimal Java 17 environment
FROM python:3.9.7-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17 and Python 3.9
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8

RUN apt-get -y update && \
apt-get install -y apt-utils && \
apt-get install -q -y --no-install-recommends curl dnsutils

RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
libhdf5-103 libhdf5-cpp-103 libcurl4-openssl-dev zip

COPY --from=build /vcellroot/build/bin /vcellbin

WORKDIR /vcellbin
Expand Down

0 comments on commit 68eb1f2

Please sign in to comment.