Skip to content

Commit 68eb1f2

Browse files
committed
smaller multistage builds
1 parent 9694197 commit 68eb1f2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Dockerfile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
FROM eclipse-temurin:17-jdk-jammy as build
1+
FROM python:3.9.7-slim AS build
22

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

87
COPY . /vcellroot
98

@@ -27,12 +26,7 @@ RUN /usr/bin/cmake \
2726
make && \
2827
ctest -VV
2928

30-
FROM eclipse-temurin:17-jdk-jammy as runtime
31-
32-
RUN apt-get -y update && apt-get install -y apt-utils && \
33-
apt-get install -y -qq -o=Dpkg::Use-Pty=0 build-essential gfortran zlib1g-dev \
34-
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip && \
35-
apt-get install -q -y --no-install-recommends curl dnsutils
29+
FROM eclipse-temurin:17 AS jre-build
3630

3731
# Create a custom Java runtime
3832
RUN $JAVA_HOME/bin/jlink \
@@ -43,12 +37,23 @@ RUN $JAVA_HOME/bin/jlink \
4337
--compress=2 \
4438
--output /javaruntime
4539

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

46+
# now we have Java 17 and Python 3.9
4947
ENV DEBIAN_FRONTEND=noninteractive
5048
ENV LANG=en_US.UTF-8
5149

50+
RUN apt-get -y update && \
51+
apt-get install -y apt-utils && \
52+
apt-get install -q -y --no-install-recommends curl dnsutils
53+
54+
RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
55+
libhdf5-103 libhdf5-cpp-103 libcurl4-openssl-dev zip
56+
5257
COPY --from=build /vcellroot/build/bin /vcellbin
5358

5459
WORKDIR /vcellbin

0 commit comments

Comments
 (0)