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

Commit

Permalink
Major updates to the getting started guide and started process of cle…
Browse files Browse the repository at this point in the history
…aning up Docker scripts to work with the newest version of the code
  • Loading branch information
daminton committed Feb 29, 2024
1 parent 4c62739 commit a56dd5d
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 1,120 deletions.
67 changes: 15 additions & 52 deletions Dockerfile.GNU-Linux
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# dynamically.

# This build target compiles all dependencies and the swiftest driver itself
FROM continuumio/miniconda3:23.5.2-0 as build-deps
FROM ubuntu:focal-20240123 as build-deps
SHELL ["/bin/bash", "--login", "-c"]
ENV PATH="/opt/conda/bin:${PATH}"
WORKDIR /swiftest

ENV INSTALL_DIR=/usr/local
Expand All @@ -29,69 +28,29 @@ ENV LD_LIBRARY_PATH="${INSTALL_DIR}/lib"
ENV LDFLAGS="-L${INSTALL_DIR}/lib"
ENV CPPFLAGS="-I${INSTALL_DIR}/include"

COPY ./buildscripts/swiftest-build-env.yml ./
COPY ./buildscripts/fetch_dependencies.sh ./
RUN ./fetch_dependencies.sh -d ./
COPY ./buildscripts/ ./buildscripts/
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
m4 && \
rm -rf /var/lib/apt/lists/* && \
buildscripts/build_dependencies.sh -p ${INSTALL_DIR}

# Get the HDF5, NetCDF-C, and NetCDF-Fortran libraries
RUN conda update --all -y && \
conda install conda-libmamba-solver -y && \
conda config --set solver libmamba && \
conda env create --file swiftest-build-env.yml --name swiftest-build-env && \
conda init bash && \
echo "conda activate swiftest-build-env" >> ~/.bashrc

RUN cd zlib-* && \
./configure \
--prefix=${INSTALL_DIR} \
--static && \
make && make install && \
cd ../hdf5-* && \
./configure \
--prefix=${INSTALL_DIR} \
--disable-shared \
--enable-build-mode=production \
--disable-fortran \
--disable-java \
--disable-cxx \
--with-zlib=${INSTALL_DIR} && \
make && make install && \
cd ../netcdf-c-* && \
./configure \
--prefix=${INSTALL_DIR} \
--disable-shared \
--disable-dap \
--disable-libxml2 \
--disable-byterange && \
make && make install && \
cd ../netcdf-fortran-* && \
export CFLAGS="-fPIC" && \
export FCFLAGS="${CFLAGS}" && \
export FFLAGS=${CFLAGS} && \
export LIBS=$(${INSTALL_DIR}/bin/nc-config --libs --static) && \
./configure --disable-shared --prefix=${NFDIR} && \
make && make install

FROM continuumio/miniconda3:23.5.2-0 as build-swiftest
FROM ubuntu:focal-20240123 as build-swiftest
SHELL ["/bin/bash", "--login", "-c"]
ENV SHELL="/bin/bash"
WORKDIR /swiftest

# Copy build artifacts over to the swiftest package builder stage
ENV INSTALL_DIR=/usr/local
COPY --from=build-deps ${INSTALL_DIR}/ ${INSTALL_DIR}/
COPY --from=build-deps /opt/conda/envs/ /opt/conda/envs/
COPY --from=build-deps /root/.bashrc /root/

# Compile the Swiftest project
COPY ./cmake/ ./cmake/
COPY ./pyproject.toml ./
COPY ./src/ ./src/
COPY ./swiftest/ ./swiftest/
COPY ./tests/ ./tests/
COPY ./CMakeLists.txt ./
COPY ./setup.py ./
COPY ./environment.yml ./
COPY ./pyproject.toml ./
COPY ./requirements.txt ./
COPY ./version.txt ./

# Generate the build environment in conda
Expand All @@ -107,4 +66,8 @@ RUN export NFCFG="${INSTALL_DIR}/bin/nf-config" && \

#Export the generated wheel file to the host machine
FROM scratch as export-wheel
COPY --from=build-swiftest /swiftest/dist/ ./
COPY --from=build-swiftest /swiftest/dist/ ./

FROM scratch as export-driver
COPY --from=build-swiftest /swiftest/build/bin/swiftest_driver ./
COPY --from=build-swiftest /swiftest/build/bin/libswiftest.so ./
47 changes: 8 additions & 39 deletions Dockerfile.Intel
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,12 @@ ENV LD_LIBRARY_PATH="${INSTALL_DIR}/lib"
ENV LDFLAGS="-L${INSTALL_DIR}/lib"
ENV CPPFLAGS="-I${INSTALL_DIR}/include"

COPY ./buildscripts/fetch_dependencies.sh ./
COPY ./buildscripts/ ./buildscripts/
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
m4 && \
rm -rf /var/lib/apt/lists/* && \
./fetch_dependencies.sh -d ./

# Get the HDF5, NetCDF-C, and NetCDF-Fortran libraries
RUN cd zlib-* && \
./configure \
--prefix=${INSTALL_DIR} \
--static && \
make && make install && \
cd ../hdf5-* && \
./configure \
--prefix=${INSTALL_DIR} \
--disable-shared \
--enable-build-mode=production \
--disable-fortran \
--disable-java \
--disable-cxx \
--with-zlib=${INSTALL_DIR} && \
make && make install && \
cd ../netcdf-c-* && \
./configure \
--prefix=${INSTALL_DIR} \
--disable-shared \
--disable-dap \
--disable-libxml2 \
--disable-byterange && \
make && make install
RUN cd netcdf-fortran-* && \
export CFLAGS="-fPIC" && \
export FCFLAGS="${CFLAGS} -standard-semantics" && \
export FFLAGS=${CFLAGS} && \
export LIBS=$(${INSTALL_DIR}/bin/nc-config --libs --static) && \
./configure --disable-shared --prefix=${NFDIR} && \
make && make install
buildscripts/build_dependencies.sh -p ${INSTALL_DIR}

FROM intel/oneapi-hpckit:2023.1.0-devel-ubuntu20.04 as build-swiftest
ENV SCRIPT_DIR="buildscripts"
Expand All @@ -98,18 +66,15 @@ ENV LD_LIBRARY_PATH="${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}"
COPY --from=build-deps ${INSTALL_DIR}/ ${INSTALL_DIR}/

# Compile the Swiftest project
COPY ./requirements.txt ./
COPY ./environment.yml ./
COPY ./cmake/ ./cmake/
COPY ./pyproject.toml ./
COPY ./setup.py ./
COPY ./src/ ./src/
COPY ./swiftest/ ./swiftest/
COPY ./tests/ ./tests/
COPY ./CMakeLists.txt ./
COPY ./version.txt ./
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install python3-pip python3.8-venv -y

# Generate the build environment in conda
ENV PIP_ROOT_USER_ACTION=ignore
ENV LDFLAGS="-L${INSTALL_DIR}/lib"
ENV CFLAGS="-fPIC"
Expand All @@ -123,4 +88,8 @@ RUN export NFCFG="${INSTALL_DIR}/bin/nf-config" && \

#Export the generated wheel file to the host machine
FROM scratch as export-wheel
COPY --from=build-swiftest /swiftest/dist/ ./
COPY --from=build-swiftest /swiftest/dist/ ./

FROM scratch as export-driver
COPY --from=build-swiftest /swiftest/build/bin/swiftest_driver ./
COPY --from=build-swiftest /swiftest/build/bin/libswiftest.so ./
Loading

0 comments on commit a56dd5d

Please sign in to comment.