Skip to content

Commit 9694197

Browse files
committed
2 stage Docker build to reduce size for singularity
1 parent 8aacbd8 commit 9694197

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

Dockerfile

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
1-
FROM eclipse-temurin:17-jdk-jammy
1+
FROM eclipse-temurin:17-jdk-jammy 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 && \
5+
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip && \
66
apt-get install -q -y --no-install-recommends curl dnsutils
77

8-
# Create a custom Java runtime
9-
RUN $JAVA_HOME/bin/jlink \
10-
--add-modules ALL-MODULE-PATH \
11-
--strip-debug \
12-
--no-man-pages \
13-
--no-header-files \
14-
--compress=2 \
15-
--output /javaruntime
16-
17-
ENV JAVA_HOME=/javaruntime
18-
ENV PATH="${JAVA_HOME}/bin:${PATH}"
19-
20-
ENV DEBIAN_FRONTEND=noninteractive
21-
ENV LANG=en_US.UTF-8
22-
238
COPY . /vcellroot
249

2510
RUN mkdir -p /vcellroot/build/bin
@@ -40,8 +25,31 @@ RUN /usr/bin/cmake \
4025
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
4126
.. && \
4227
make && \
43-
ctest -VV && \
44-
mv /vcellroot/build/bin /vcellbin
28+
ctest -VV
29+
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
36+
37+
# Create a custom Java runtime
38+
RUN $JAVA_HOME/bin/jlink \
39+
--add-modules ALL-MODULE-PATH \
40+
--strip-debug \
41+
--no-man-pages \
42+
--no-header-files \
43+
--compress=2 \
44+
--output /javaruntime
45+
46+
ENV JAVA_HOME=/javaruntime
47+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
48+
49+
ENV DEBIAN_FRONTEND=noninteractive
50+
ENV LANG=en_US.UTF-8
51+
52+
COPY --from=build /vcellroot/build/bin /vcellbin
4553

4654
WORKDIR /vcellbin
4755
ENV PATH=/vcellbin:$PATH

0 commit comments

Comments
 (0)