Skip to content

Commit

Permalink
Simplified single-stage Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Jul 30, 2024
1 parent 42fec0f commit 8aacbd8
Showing 1 changed file with 18 additions and 73 deletions.
91 changes: 18 additions & 73 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
FROM ubuntu:22.04 as build
FROM eclipse-temurin:17-jdk-jammy

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
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 && \
apt-get install -q -y --no-install-recommends curl dnsutils

##
## build PETSc with mpich for static linking
##
#RUN mkdir /usr/local/petsc && \
# cd /usr/local/petsc && \
# wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.7.7.tar.gz && \
# tar xzf petsc-3.7.7.tar.gz && \
# cd petsc-3.7.7 && \
# ./configure --with-shared-libraries=0 --download-fblaslapack=1 --with-debugging=1 --download-mpich && \
# make PETSC_DIR=/usr/local/petsc/petsc-3.7.7 PETSC_ARCH=arch-linux2-c-debug all
# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
--add-modules ALL-MODULE-PATH \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime

ENV JAVA_HOME=/javaruntime
ENV PATH="${JAVA_HOME}/bin:${PATH}"

#ENV PETSC_DIR=/usr/local/petsc/petsc-3.7.7 \
# PETSC_ARCH=arch-linux2-c-debug
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8

COPY . /vcellroot

#
# build most solvers, and FiniteVolume without PETSc (FiniteVolume_x64)
#
RUN mkdir -p /vcellroot/build/bin
WORKDIR /vcellroot/build

Expand All @@ -41,62 +40,8 @@ RUN /usr/bin/cmake \
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
.. && \
make && \
ctest -VV

##
## build FiniteVolume with PETSc (FiniteVolume_PETSc_x64)
##
#RUN mkdir -p /vcellroot/build_PETSc/bin
#WORKDIR /vcellroot/build_PETSc
#
#RUN /usr/bin/cmake \
# -DOPTION_TARGET_MESSAGING=ON \
# -DOPTION_TARGET_PARALLEL=OFF \
# -DOPTION_TARGET_PETSC=ON \
# -DOPTION_TARGET_CHOMBO2D_SOLVER=OFF \
# -DOPTION_TARGET_CHOMBO3D_SOLVER=OFF \
# -DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
# -DOPTION_TARGET_FV_SOLVER=ON \
# -DOPTION_TARGET_STOCHASTIC_SOLVER=OFF \
# -DOPTION_TARGET_NFSIM_SOLVER=OFF \
# -DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
# -DOPTION_TARGET_SUNDIALS_SOLVER=OFF \
# -DOPTION_TARGET_HY3S_SOLVERS=OFF \
# .. && \
# make && \
# ctest


FROM eclipse-temurin:17 as jre-build

# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
--add-modules ALL-MODULE-PATH \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime
ctest -VV && \
mv /vcellroot/build/bin /vcellbin

# 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 update && \
apt-get install -y apt-utils && \
apt-get install -q -y --no-install-recommends curl dnsutils

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

COPY --from=build /vcellroot/build/bin /vcellbin
#COPY --from=build /vcellroot/build_PETSc/bin/FiniteVolume_PETSc_x64 /vcellbin/
WORKDIR /vcellbin
ENV PATH=/vcellbin:$PATH

0 comments on commit 8aacbd8

Please sign in to comment.