Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Draft Dockerfile for creating a container for Swftest. I've commente…
Browse files Browse the repository at this point in the history
…d out everything after netcdf-c compilation to troubleshoot the location of mpiifort for compiling the rest.
  • Loading branch information
daminton committed May 22, 2023
1 parent 4fa3506 commit 9556d18
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ dump*
!docs/*/*/*
!README_figs/*

#Docker and Singularity files
!Dockerfile
!swiftest.def

bin/
build/*
disruption_headon/swiftest_driver.sh


64 changes: 64 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM debian:stable-slim as build

# kick everything off
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates curl git gpg-agent software-properties-common build-essential gnupg pkg-config libaec-dev && \
rm -rf /var/lib/apt/lists/*

# Get CMAKE and install it
RUN mkdir -p cmake/build && \
cd cmake/build && \
curl -LO https://github.com/Kitware/CMake/releases/download/v3.26.2/cmake-3.26.2-linux-x86_64.sh && \
/bin/bash cmake-3.26.2-linux-x86_64.sh --prefix=/usr/local --skip-license

# Get the Intel compilers
RUN curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | apt-key add -
RUN echo "deb [trusted=yes] https://apt.repos.intel.com/oneapi all main " > /etc/apt/sources.list.d/oneAPI.list
RUN apt-get -y update && apt-get upgrade -y
RUN apt-get install -y intel-oneapi-dev-utilities intel-oneapi-compiler-dpcpp-cpp intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-compiler-fortran intel-oneapi-mkl-devel intel-oneapi-mpi-devel
RUN . /opt/intel/oneapi/setvars.sh

# Build the NetCDF libraries
RUN mkdir -p /opt/build && mkdir -p /opt/dist
ENV INDIR="/opt/dist//usr/local"
ENV INTEL_DIR="/opt/intel/oneapi/compiler/latest/linux"
ENV CC="${INTEL_DIR}/bin/icx-cc"
ENV FC="${INTEL_DIR}/mpi/latest/bin/mpiifort"

RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libhdf5-dev hdf5-tools zlib1g zlib1g-dev libxml2-dev libcurl-dev && \
rm -rf /var/lib/apt/lists/*


#NetCDF-c library
RUN git clone https://github.com/Unidata/netcdf-c.git
RUN cd netcdf-c && mkdir build && cd build && \
cmake .. -DCMAKE_PREFIX_PATH="${LD_LIBRARY_PATH}" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX="${INDIR}" && \
make && make install

#NetCDF-Fortran library
RUN git clone https://github.com/Unidata/netcdf-fortran.git
RUN cd netcdf-fortran && mkdir build && cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX="${INDIR}" && \
make && make install

#Swiftest
RUN git clone -b debug https://github.com/carlislewishard/swiftest.git
RUN cd swiftest && cmake -P distclean.cmake && mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX="${INDIR}" && \
make && make install

#Production container
FROM debian:stable-slim
COPY --from=build /opt/dist /

# Get the Intel runtime libraries
RUN curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | apt-key add -
RUN deb [trusted=yes] https://apt.repos.intel.com/oneapi all main " > /etc/apt/sources.list.d/oneAPI.list
RUN apt-get -y update && apt-get upgrade -y
RUN apt-get install -y intel-oneapi-runtime-openmp intel-oneapi-runtime-mkl intel-oneapi-runtime-mpi intel-oneapi-runtime-fortran
RUN . /opt/intel/oneapi/setvars.sh
CMD ["/usr/bin/swiftest_driver"]
2 changes: 2 additions & 0 deletions swiftest.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bootstrap: docker
From: daminton:swiftest:latest

0 comments on commit 9556d18

Please sign in to comment.