diff --git a/Dockerfile b/Dockerfile index 22191083..243f19ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 \ @@ -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