From b3a04625f58c5ce008030424be514a726b5f4882 Mon Sep 17 00:00:00 2001 From: Konrad Eder <53946421+Eder-K@users.noreply.github.com> Date: Tue, 22 Dec 2020 09:26:03 +0100 Subject: [PATCH 1/3] Capitalize FEniCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin RĂ¼th --- adapters/Dockerfile.fenics-adapter | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/adapters/Dockerfile.fenics-adapter b/adapters/Dockerfile.fenics-adapter index 82b90ca5d..cc656da79 100644 --- a/adapters/Dockerfile.fenics-adapter +++ b/adapters/Dockerfile.fenics-adapter @@ -18,11 +18,7 @@ RUN apt-get -qq update && apt-get -qq install \ python3-dev && \ rm -rf /var/lib/apt/lists/* -# Install pip dependecies; we have to use pip, since cython provided by apt-get is too old. -RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py && \ - python3 get-pip.py - - +# Install FEniCS RUN add-apt-repository -y ppa:fenics-packages/fenics && \ apt-get -qq update && \ apt-get -qq install --no-install-recommends fenics && \ From 2d164c33d42f620e1a0c02408c676af6b0ef7681 Mon Sep 17 00:00:00 2001 From: Eder-K Date: Tue, 22 Dec 2020 10:25:54 +0100 Subject: [PATCH 2/3] Clean up Dockerfiles Add/Update comments and reorder some commands for consistent format --- adapters/Dockerfile.calculix-adapter | 16 +++-- adapters/Dockerfile.codeaster-adapter | 15 ++--- adapters/Dockerfile.dealii-adapter | 8 +++ adapters/Dockerfile.dealii-adapter_3D | 8 +++ adapters/Dockerfile.fenics-adapter | 17 +++-- adapters/Dockerfile.openfoam-adapter | 13 ++-- adapters/Dockerfile.su2-adapter | 12 +++- precice/Dockerfile.Ubuntu1604.home | 6 ++ precice/Dockerfile.Ubuntu1604.package | 6 ++ precice/Dockerfile.Ubuntu1804.home | 51 ++++++++------- precice/Dockerfile.Ubuntu1804.package | 79 +++++++++++++----------- precice/Dockerfile.Ubuntu1804.sudo.mpich | 10 ++- precice/Dockerfile.Ubuntu2004.home | 60 +++++++++--------- precice/Dockerfile.Ubuntu2004.package | 54 +++++++++------- 14 files changed, 213 insertions(+), 142 deletions(-) diff --git a/adapters/Dockerfile.calculix-adapter b/adapters/Dockerfile.calculix-adapter index 725c0b618..50317518c 100644 --- a/adapters/Dockerfile.calculix-adapter +++ b/adapters/Dockerfile.calculix-adapter @@ -1,10 +1,14 @@ +# Dockerfile for building the calculix-adapter for preCICE +# NOTE: Built for CalculiX v2.16 + +# Building on top of the latest preCICE-build ARG branch=develop ARG from=precice/precice-ubuntu1804.home-${branch} FROM $from USER root -# ( since we are importing form the precice image ) +# Install dependencies RUN apt-get -qq update && apt-get -qq install \ build-essential \ gfortran \ @@ -19,20 +23,24 @@ RUN apt-get -qq update && apt-get -qq install \ libyaml-cpp-dev && \ rm -rf /var/lib/apt/lists/* +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST USER precice -# get calculix source + +# Get calculix source (using version 2.16) WORKDIR /home/precice RUN curl -s http://www.dhondt.de/ccx_2.16.src.tar.bz2 | tar -xj + +# Get adapter source ARG adapter_branch=develop RUN git clone --depth 1 --branch $adapter_branch https://github.com/precice/calculix-adapter.git -# build adapter +# Build adapter WORKDIR calculix-adapter/ RUN make -j $(nproc) -# create directory for input/out/exchange +# Create directory for input/out/exchange WORKDIR /home/precice RUN mkdir -p Logs Data/Input Data/Output Data/Exchange ENV PATH="/home/precice/calculix-adapter/bin:${PATH}" diff --git a/adapters/Dockerfile.codeaster-adapter b/adapters/Dockerfile.codeaster-adapter index c4d9f75fa..ffb6d3fa8 100644 --- a/adapters/Dockerfile.codeaster-adapter +++ b/adapters/Dockerfile.codeaster-adapter @@ -1,3 +1,6 @@ +# Dockerfile for building the codeaster-adapter for preCICE + +# Building on top of the latest preCICE-build ARG branch=develop ARG from=precice/precice-ubuntu1804.home-${branch} ARG base_solver=precice/codeaster @@ -7,7 +10,7 @@ FROM $from USER root ENV USER=root -# Install dependecies +# Install dependencies RUN apt-get -qq update && apt-get -qq install \ git \ locales \ @@ -15,12 +18,10 @@ RUN apt-get -qq update && apt-get -qq install \ python3-numpy && \ rm -rf /var/lib/apt/lists/* -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 +# Rebuild image from here if `force_rebuild` is enabled +ARG CACHEBUST -# Building Code_Aster-adapter +# Build Code_Aster-adapter USER precice WORKDIR /home/precice @@ -38,6 +39,6 @@ RUN \ RUN \ mkdir Data Logs && cd Data && mkdir Exchange Input Output -# Installing python bindings for preCICE +# Install python bindings for preCICE RUN \ pip3 install --upgrade pip && pip3 install --user pyprecice diff --git a/adapters/Dockerfile.dealii-adapter b/adapters/Dockerfile.dealii-adapter index 80f6c2332..7a1a1b9bc 100644 --- a/adapters/Dockerfile.dealii-adapter +++ b/adapters/Dockerfile.dealii-adapter @@ -1,11 +1,17 @@ +# Dockerfile for building the dealii-adapter for preCICE +# NOTE: Built with dimension argument set to 2. + +# Building on top of the latest preCICE-build ARG branch=develop ARG from=precice/precice-ubuntu1804.home-${branch} ARG base_solver=precice/deal.ii FROM ${base_solver} as deal.ii FROM $from +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST +# Get solver COPY --from=deal.ii /home/precice/dealii/ /home/precice/dealii/ COPY --from=deal.ii /home/precice/dealii_build/ /home/precice/dealii_build/ @@ -13,9 +19,11 @@ USER precice WORKDIR /home/precice RUN mkdir -p Logs Data/Input Data/Output Data/Exchange +# Get adapter source ARG adapter_branch=develop RUN git clone --depth 1 --branch $adapter_branch https://github.com/precice/dealii-adapter.git +# Build adapter RUN cd dealii-adapter/linear_elasticity/ && \ cmake -DDEAL_II_DIR=$HOME/dealii_build -DDIM=2 -DCMAKE_BUILD_TYPE=Release . && \ make -j $(nproc) diff --git a/adapters/Dockerfile.dealii-adapter_3D b/adapters/Dockerfile.dealii-adapter_3D index 9cf04e758..e1ff1c36c 100644 --- a/adapters/Dockerfile.dealii-adapter_3D +++ b/adapters/Dockerfile.dealii-adapter_3D @@ -1,11 +1,17 @@ +# Dockerfile for building the dealii-adapter for preCICE +# NOTE: Built with dimension argument set to 3. + +# Building on top of the latest preCICE-build ARG branch=develop ARG from=precice/precice-ubuntu1804.home-${branch} ARG base_solver=precice/deal.ii FROM ${base_solver} as deal.ii FROM $from +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST +# Get solver COPY --from=deal.ii /home/precice/dealii/ /home/precice/dealii/ COPY --from=deal.ii /home/precice/dealii_build/ /home/precice/dealii_build/ @@ -13,9 +19,11 @@ USER precice WORKDIR /home/precice RUN mkdir -p Logs Data/Input Data/Output Data/Exchange +# Get adapter source ARG adapter_branch=develop RUN git clone --branch $adapter_branch https://github.com/precice/dealii-adapter.git +# Build adapter RUN cd dealii-adapter/linear_elasticity/ && \ cmake -DDEAL_II_DIR=$HOME/dealii_build -DDIM=3 -DCMAKE_BUILD_TYPE=Release . && \ make -j $(nproc) diff --git a/adapters/Dockerfile.fenics-adapter b/adapters/Dockerfile.fenics-adapter index cc656da79..3556779cd 100644 --- a/adapters/Dockerfile.fenics-adapter +++ b/adapters/Dockerfile.fenics-adapter @@ -1,4 +1,9 @@ -# System testing preCICE with fenics-adapter +# Dockerfile for building the fenics-adapter for preCICE +# NOTE: At the moment, fenics has some dependency issues, which +# requires us to use some workarounds for building the adapter. +# At a later point, these workarounds should be removed: +# 1. precice-Ubuntu1804.package being built with outdated PETSc version +# 2. Manually uninstalling the fenics-ufl package (in this file) # Building on top of the latest preCICE-build ARG branch=develop @@ -9,7 +14,7 @@ USER root ENV USER=root ENV DEBIAN_FRONTEND=noninteractive -# Installing necessary dependencies +# Install necessary dependencies RUN apt-get -qq update && apt-get -qq install \ apt-utils && \ apt-get -qq install \ @@ -25,21 +30,21 @@ RUN add-apt-repository -y ppa:fenics-packages/fenics && \ rm -rf /var/lib/apt/lists/* +# Install pip dependencies; we have to use pip, since cython provided by apt-get is too old. RUN pip3 install --user cython # TODO: can we put this dependency into requirements.txt of python? USER precice - -# Rebuild image if force_rebuild after that command +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST ARG bindings_branch=develop ARG adapter_branch=develop -# Builds the precice python bindings for python3 +# Build the precice python bindings for python3 RUN pip3 install --user https://github.com/precice/python-bindings/archive/$bindings_branch.zip -# Building fenics-adapter +# Build fenics-adapter RUN pip3 install --user numpy==1.14.5 https://github.com/precice/fenics-adapter/archive/$adapter_branch.zip diff --git a/adapters/Dockerfile.openfoam-adapter b/adapters/Dockerfile.openfoam-adapter index 80a5e3235..7db68cbe3 100644 --- a/adapters/Dockerfile.openfoam-adapter +++ b/adapters/Dockerfile.openfoam-adapter @@ -1,3 +1,6 @@ +# Dockerfile for building the openfoam-adapter for preCICE +# NOTE: Built for OpenFOAM v2006 + ARG branch=develop ARG from=precice/precice-ubuntu1804.home-${branch} # ARG base_solver=precice/openfoam @@ -7,14 +10,14 @@ FROM $from USER root ENV USER=root -# Install dependecies +# Install dependencies RUN apt-get -qq update && apt-get -qq install \ software-properties-common \ wget apt-transport-https && \ rm -rf /var/lib/apt/lists/* - +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST # Install OpenFOAM v2006 @@ -22,11 +25,7 @@ ARG CACHEBUST RUN wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash && \ apt-get install -y openfoam2006-default -# # Get OpenFOAM5 install via folder copy -# COPY --from=openfoam /opt/openfoam5 /opt/openfoam5/ -# for of5, we need to also source the file at /opt/openfoam5/etc/bashrc - -# Building openfoam-adapter +# Build openfoam-adapter USER precice SHELL ["/bin/bash", "-c"] # without this command /opt/openfoam5/etc/bashrc cannot be sourced WORKDIR /home/precice diff --git a/adapters/Dockerfile.su2-adapter b/adapters/Dockerfile.su2-adapter index 13f42a92c..bb065d0ca 100644 --- a/adapters/Dockerfile.su2-adapter +++ b/adapters/Dockerfile.su2-adapter @@ -1,10 +1,14 @@ +# Dockerfile for building the su2-adapter for preCICE +# NOTE: Built for SU2 v6.0.0 + ARG branch=develop -ARG from=precice/precice-ubuntu1604.home-${branch} +ARG from=precice/precice-ubuntu1804.home-${branch} FROM $from USER root ENV CXX="g++" +# Install dependencies RUN apt-get -qq update && apt-get -qq install \ dh-autoreconf \ automake \ @@ -13,24 +17,30 @@ RUN apt-get -qq update && apt-get -qq install \ ccache \ time +# Rebuild image from here if `force_rebuild` is enabled ARG CACHEBUST USER precice + +# Get solver WORKDIR /home/precice RUN mkdir -p Logs Data/Input Data/Output Data/Exchange RUN git clone --depth 1 --branch v6.0.0 https://github.com/su2code/SU2.git su2-source +# Set solver environment variables ENV SU2_HOME="/home/precice/su2-source" \ SU2_BIN="/home/precice/su2-bin" \ SU2_RUN="/home/precice/su2-bin/bin" \ PATH="/home/precice/su2-bin/bin:${PATH}" \ PYTHONPATH="/home/precice/su2-bin/bin:${PYTHONPATH}" +# Get adapter source ARG adapter_branch=develop RUN cd /home/precice && \ git clone --depth 1 --branch $adapter_branch https://github.com/precice/su2-adapter.git && cd su2-adapter && \ ./su2AdapterInstall +# Build adapter WORKDIR /home/precice/su2-source RUN ./configure --disable-metis --disable-parmetis --disable-cgns --disable-DOT \ --disable-MSH --disable-DEF --disable-SOL --disable-GEO \ diff --git a/precice/Dockerfile.Ubuntu1604.home b/precice/Dockerfile.Ubuntu1604.home index 4153d288f..cacb155b1 100644 --- a/precice/Dockerfile.Ubuntu1604.home +++ b/precice/Dockerfile.Ubuntu1604.home @@ -1,5 +1,11 @@ # Dockerfile for building preCICE on ubuntu 16.04 +# ################# +# WARNING: As of 11.2020, images using Ubuntu 16.04 are no longer maintained. +# Attempting to build this dockerfile or using it as base image for +# other builds is likely to fail. +# ################# + # Using ubuntu 16.04 as basis FROM ubuntu:16.04 diff --git a/precice/Dockerfile.Ubuntu1604.package b/precice/Dockerfile.Ubuntu1604.package index 4ec678d0f..4496d7f4c 100644 --- a/precice/Dockerfile.Ubuntu1604.package +++ b/precice/Dockerfile.Ubuntu1604.package @@ -1,5 +1,11 @@ # Dockerfile for building preCICE on ubuntu 16.04 +# ################# +# WARNING: As of 11.2020, images using Ubuntu 16.04 are no longer maintained. +# Attempting to build this dockerfile or using it as base image for +# other builds is likely to fail. +# ################# + # Using ubuntu 16.04 as basis FROM ubuntu:16.04 diff --git a/precice/Dockerfile.Ubuntu1804.home b/precice/Dockerfile.Ubuntu1804.home index 9d446042e..dc3245949 100644 --- a/precice/Dockerfile.Ubuntu1804.home +++ b/precice/Dockerfile.Ubuntu1804.home @@ -1,10 +1,17 @@ -# Dockerfile for building preCICE on Ubuntu 18.04 -# default setup, user set to 'precice', manual install +# Dockerfile for building preCICE +# OS version: Ubuntu 18.04 +# User: precice +# PETSc install: from source +# precice install: default + # Use official Ubuntu 18.04 as base FROM ubuntu:18.04 -# Installing necessary dependacies for preCICE, boost 1.65 from apt-get +# Avoid timeouts during install due to interactive installs +ARG DEBIAN_FRONTEND=noninteractive + +# Install necessary dependencies for preCICE, Boost 1.65 from apt-get RUN apt-get -qq update && apt-get -qq install \ build-essential \ locales \ @@ -20,13 +27,13 @@ RUN apt-get -qq update && apt-get -qq install \ cmake && \ rm -rf /var/lib/apt/lists/* -# create user precice +# Create user precice ARG uid=1000 ARG gid=1000 RUN groupadd -g ${gid} precice \ - && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice + && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice -# set locale +# Set locale RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 @@ -34,21 +41,20 @@ ENV LANGUAGE en_US:en ENV LC_NUMERIC en_US.UTF-8 ENV LC_ALL en_US.UTF-8 - -# Install PETSc from source +# Install PETSc v3.12.5 from source (apt version too low) WORKDIR /petsc RUN wget -nv 'https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-3.12.5.tar.gz' -O - | tar xz && \ - cd petsc-3.12.5 && \ - ./configure && \ - make all test +cd petsc-3.12.5 && \ +./configure && \ +make all test RUN chown -R precice:precice /petsc -# Rebuild image if force_rebuild after that command +USER precice + +# Rebuild image from here on if `force_rebuild` is enabled ARG CACHEBUST -USER precice -WORKDIR /home/precice -# Setting some environment variables for installing preCICE +# Set some environment variables for installing preCICE ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ CPATH="/usr/include/eigen3:${CPATH}" \ PETSC_DIR="/petsc/petsc-3.12.5" \ @@ -56,21 +62,18 @@ ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ LD_LIBRARY_PATH="/petsc/petsc-3.12.5/arch-linux2-c-debug/lib:${LD_LIBRARY_PATH}" \ PKG_CONFIG_PATH="/petsc/petsc-3.12.5/arch-linux2-c-debug/lib/pkgconfig:${PKG_CONFIG_PATH}" - -# Building preCICE +# Build preCICE +WORKDIR /home/precice ARG branch=develop RUN git clone --depth 1 --branch $branch https://github.com/precice/precice.git /home/precice/precice -WORKDIR /home/precice/precice -# Some parameters for the build, you can set them in the build command e.g. -# sudo docker build Dockerfile.precice --build-arg petsc_para=yes --build-arg mpi_para=yes . -# this will result in -# cmake -DPRECICE_PETScMapping=yes -DPRECICE_MPICommunication=yes -DPRECICE_PythonActions=no -DCMAKE_CXX_COMPILER=mpicxx -j2 /precice +# Set parameters for the build, these can be overwritten by the docker build command +# Example: `docker build --build-arg petsc_para=yes --build-arg mpi_para=yes .` ARG petsc_para=no ARG mpi_para=yes ARG python_para=no -# Build preCICE and clean-up generated object files +# Build preCICE and clean-up generated object files afterwards RUN mkdir /home/precice/precice-build && \ cd /home/precice/precice-build && \ mkdir /home/precice/precice-install && \ @@ -86,7 +89,7 @@ RUN mkdir /home/precice/precice-build && \ make install && \ rm -r /home/precice/precice-build -# Setting preCICE environment variables +# Set preCICE environment variables ENV PRECICE_ROOT="/home/precice/precice" \ PKG_CONFIG_PATH="/home/precice/precice-install/lib/pkgconfig:${PKG_CONFIG_PATH}" \ LD_LIBRARY_PATH="/home/precice/precice-install/lib:${LD_LIBRARY_PATH}" \ diff --git a/precice/Dockerfile.Ubuntu1804.package b/precice/Dockerfile.Ubuntu1804.package index ab39836c0..342b9abe6 100644 --- a/precice/Dockerfile.Ubuntu1804.package +++ b/precice/Dockerfile.Ubuntu1804.package @@ -1,68 +1,73 @@ -# Dockerfile for building preCICE on Ubuntu 18.04 -# default setup, user set to 'precice', package install +# Dockerfile for building preCICE +# OS version: Ubuntu 18.04 +# User: precice +# PETSc install: from apt [OUTDATED] +# precice install: as Debian package + +# Note: This image should always be built with PETSc support disabled! +# The installation of petsc-dev through apt is strictly necessary for the +# fenics-adapter, whereby we cannot overwrite the installation by building +# PETSc from source. As a result, the PETSc version installed here is needed, +# but not sufficient for building with preCICE. # Use official Ubuntu 18.04 as base FROM ubuntu:18.04 -# Installing necessary dependacies for preCICE, boost 1.65 from apt-get +# Avoid timeouts during install due to interactive installs +ARG DEBIAN_FRONTEND=noninteractive + +# Install necessary dependencies for preCICE, Boost 1.65 from apt-get RUN apt-get -qq update && apt-get -qq install \ build-essential \ locales \ libboost-all-dev \ libeigen3-dev \ libxml2-dev \ - petsc-dev \ git \ python3-numpy \ python3-dev \ + petsc-dev \ wget \ bzip2 \ cmake && \ rm -rf /var/lib/apt/lists/* - # create user precice - ARG uid=1000 - ARG gid=1000 - RUN groupadd -g ${gid} precice \ - && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice +# Create user precice +ARG uid=1000 +ARG gid=1000 +RUN groupadd -g ${gid} precice \ + && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice - # set locale - RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - locale-gen - ENV LANG en_US.UTF-8 - ENV LANGUAGE en_US:en - ENV LC_NUMERIC en_US.UTF-8 - ENV LC_ALL en_US.UTF-8 +# Set locale +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_NUMERIC en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 - # Install PETSc from source - WORKDIR /petsc - RUN wget -nv 'https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-3.12.5.tar.gz' -O - | tar xz && \ - cd petsc-3.12.5 && \ - ./configure && \ - make all check - RUN chown -R precice:precice /petsc +USER precice - # Rebuild image if force_rebuild after that command - ARG CACHEBUST - USER precice - WORKDIR /home/precice - # Setting some environment variables for installing preCICE - ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ - CPATH="/usr/include/eigen3:${CPATH}" +# Rebuild image from here on if `force_rebuild` is enabled +ARG CACHEBUST +# Set some environment variables for installing preCICE +ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ + CPATH="/usr/include/eigen3:${CPATH}" -# Building preCICE +# Build preCICE +WORKDIR /home/precice ARG branch=develop RUN git clone --depth 1 --branch $branch https://github.com/precice/precice.git /home/precice/precice -# Some parameters for the build, you can set them in the build command e.g. -# sudo docker build Dockerfile.precice --build-arg petsc_para=yes --build-arg mpi_para=yes . -# this will result in -# cmake -DPRECICE_PETScMapping=yes -DPRECICE_MPICommunication=yes -DPRECICE_PythonActions=no -DCMAKE_CXX_COMPILER=mpicxx -j2 /home/precice/precice + +# Set parameters for the build, these can be overwritten by the docker build command +# Example: `docker build --build-arg petsc_para=yes --build-arg mpi_para=yes .` ARG petsc_para=no ARG mpi_para=yes ARG python_para=no -# Build preCICE and clean-up generated object files + +# Build preCICE and clean-up generated object files afterwards RUN mkdir /home/precice/precice-build && \ cd /home/precice/precice-build && \ cmake -DBUILD_SHARED_LIBS=ON \ @@ -83,6 +88,6 @@ RUN mkdir /home/precice/precice-build && \ USER root RUN cd /home/precice && dpkg -i $(find . -maxdepth 1 -name "*.deb") -# Setting preCICE environment variables +# Set preCICE environment variables USER precice ENV PRECICE_ROOT="/home/precice/precice" diff --git a/precice/Dockerfile.Ubuntu1804.sudo.mpich b/precice/Dockerfile.Ubuntu1804.sudo.mpich index 6982640b4..17f418a98 100644 --- a/precice/Dockerfile.Ubuntu1804.sudo.mpich +++ b/precice/Dockerfile.Ubuntu1804.sudo.mpich @@ -1,5 +1,11 @@ -# Dockerfile for building preCICE on Ubuntu 18.04 -# default setup, user set to root, manual install, using MPICH +# Dockerfile for building preCICE +# OS version: Ubuntu 18.04 +# User: precice +# PETSc install: from apt [OUTDATED] +# precice install: as Debian package +# +# Uses MPICH instead of OpenMPI (default) + # Use official Ubuntu 18.04 as base FROM ubuntu:18.04 diff --git a/precice/Dockerfile.Ubuntu2004.home b/precice/Dockerfile.Ubuntu2004.home index 790d4d34c..cb0b7cfba 100644 --- a/precice/Dockerfile.Ubuntu2004.home +++ b/precice/Dockerfile.Ubuntu2004.home @@ -1,13 +1,17 @@ -# Dockerfile for building preCICE on Ubuntu 20.04 -# default setup, user set to 'precice', manual install +# Dockerfile for building preCICE +# OS version: Ubuntu 20.04 +# User: precice +# PETSc install: from apt +# precice install: default + # Use official Ubuntu 20.04 as base FROM ubuntu:20.04 +# Avoid timeouts during install due to interactive installs ARG DEBIAN_FRONTEND=noninteractive -# this is necessary to avoid timeouts during installation due to interactive installs -# Installing necessary dependencies for preCICE, boost 1.71 from apt-get +# Install necessary dependencies for preCICE, Boost 1.71 from apt-get RUN apt-get -qq update && apt-get -qq install \ build-essential \ locales \ @@ -15,20 +19,21 @@ RUN apt-get -qq update && apt-get -qq install \ libeigen3-dev \ libxml2-dev \ git \ - python-numpy \ - python-dev \ + python3-numpy \ + python3-dev \ + petsc-dev \ wget \ bzip2 \ cmake && \ rm -rf /var/lib/apt/lists/* -# create user precice +# Create user precice ARG uid=1000 ARG gid=1000 RUN groupadd -g ${gid} precice \ && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice -# set locale +# Set locale RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 @@ -36,38 +41,31 @@ ENV LANGUAGE en_US:en ENV LC_NUMERIC en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -# Install PETSc from source -WORKDIR /petsc -RUN wget -nv 'https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-3.12.5.tar.gz' -O - | tar xz && \ - cd petsc-3.12.5 && \ - ./configure --with-cc=gcc --with-cxx=g++ --with-fc=0 --download-openmpi --download-f2cblaslapack && \ - make all check -RUN chown -R precice:precice /petsc -# Rebuild image if force_rebuild after that command +USER precice + +# Upgrade pip to latest version +RUN pip3 install --user --upgrade pip + +# Rebuild image from here on if `force_rebuild` is enabled ARG CACHEBUST -USER precice -WORKDIR /home/precice -# Setting some environment variables for installing preCICE +# Set some environment variables for installing preCICE ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ - CPATH="/usr/include/eigen3:${CPATH}" \ - PETSC_DIR="/petsc/petsc-3.12.5" \ - PETSC_ARCH="arch-linux2-c-debug" \ - LD_LIBRARY_PATH="/petsc/petsc-3.12.5/arch-linux2-c-debug/lib:${LD_LIBRARY_PATH}" + CPATH="/usr/include/eigen3:${CPATH}" -# Building preCICE +# Build preCICE +WORKDIR /home/precice ARG branch=develop RUN git clone --depth 1 --branch $branch https://github.com/precice/precice.git /home/precice/precice -WORKDIR /home/precice/precice -# Some parameters for the build, you can set them in the build command e.g. -# sudo docker build Dockerfile.precice --build-arg petsc_para=yes --build-arg mpi_para=yes . -# this will result in -# cmake -DPRECICE_PETScMapping=yes -DPRECICE_MPICommunication=yes -DPRECICE_PythonActions=no -DCMAKE_CXX_COMPILER=mpicxx -j2 /precice + +# Set parameters for the build, these can be overwritten by the docker build command +# Example: `docker build --build-arg petsc_para=yes --build-arg mpi_para=yes .` ARG petsc_para=no ARG mpi_para=yes ARG python_para=no -# Build preCICE and clean-up generated object files + +# Build preCICE and clean-up generated object files afterwards RUN mkdir /home/precice/precice-build && \ cd /home/precice/precice-build && \ mkdir /home/precice/precice-install && \ @@ -83,7 +81,7 @@ RUN mkdir /home/precice/precice-build && \ make install && \ rm -r /home/precice/precice-build -# Setting preCICE environment variables +# Set preCICE environment variables ENV PRECICE_ROOT="/home/precice/precice" \ PKG_CONFIG_PATH="/home/precice/precice-install/lib/pkgconfig" \ LD_LIBRARY_PATH="/home/precice/precice-install/lib:${LD_LIBRARY_PATH}" \ diff --git a/precice/Dockerfile.Ubuntu2004.package b/precice/Dockerfile.Ubuntu2004.package index 23a4167c0..b1dbe3724 100644 --- a/precice/Dockerfile.Ubuntu2004.package +++ b/precice/Dockerfile.Ubuntu2004.package @@ -1,36 +1,39 @@ -# Dockerfile for building preCICE on Ubuntu 20.04 -# default setup, user set to 'precice', package install +# Dockerfile for building preCICE +# OS version: Ubuntu 20.04 +# User: precice +# PETSc install: from apt +# precice install: as Debian package + # Use official Ubuntu 20.04 as base FROM ubuntu:20.04 +# Avoid timeouts during install due to interactive installs ARG DEBIAN_FRONTEND=noninteractive -# this is necessary to avoid timeouts during installation due to interactive installs -# Installing necessary dependencies for preCICE, boost 1.71 from apt-get +# Install necessary dependencies for preCICE, Boost 1.71 from apt-get RUN apt-get -qq update && apt-get -qq install \ build-essential \ locales \ libboost-all-dev \ libeigen3-dev \ libxml2-dev \ - petsc-dev \ git \ - python3-dev \ python3-numpy \ + python3-dev \ petsc-dev \ wget \ bzip2 \ cmake && \ rm -rf /var/lib/apt/lists/* -# create user precice +# Create user precice ARG uid=1000 ARG gid=1000 RUN groupadd -g ${gid} precice \ - && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice + && useradd -u ${uid} -g ${gid} -m -s /bin/bash precice -# set locale +# Set locale RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 @@ -38,27 +41,31 @@ ENV LANGUAGE en_US:en ENV LC_NUMERIC en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -# Rebuild image if force_rebuild after that command -ARG CACHEBUST USER precice -WORKDIR /home/precice -# Setting some environment variables for installing preCICE + +# Upgrade pip to latest version +RUN pip3 install --user --upgrade pip + +# Rebuild image from here on if `force_rebuild` is enabled +ARG CACHEBUST + +# Set some environment variables for installing preCICE ENV CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/eigen3" \ CPATH="/usr/include/eigen3:${CPATH}" - -# Building preCICE +# Build preCICE +WORKDIR /home/precice ARG branch=develop RUN git clone --depth 1 --branch $branch https://github.com/precice/precice.git /home/precice/precice -# Some parameters for the build, you can set them in the build command e.g. -# sudo docker build Dockerfile.precice --build-arg petsc_para=yes --build-arg mpi_para=yes . -# this will result in -# cmake -DPRECICE_PETScMapping=yes -DPRECICE_MPICommunication=yes -DPRECICE_PythonActions=no -DCMAKE_CXX_COMPILER=mpicxx -j2 /home/precice/precice + +# Set parameters for the build, these can be overwritten by the docker build command +# Example: `docker build --build-arg petsc_para=yes --build-arg mpi_para=yes .` ARG petsc_para=no ARG mpi_para=yes ARG python_para=no -# Build preCICE and clean-up generated object files + +# Build preCICE and clean-up generated object files afterwards RUN mkdir /home/precice/precice-build && \ cd /home/precice/precice-build && \ cmake -DBUILD_SHARED_LIBS=ON \ @@ -75,10 +82,11 @@ RUN mkdir /home/precice/precice-build && \ make package && \ mv $(find . -maxdepth 1 -name "*.deb") /home/precice && \ rm -r /home/precice/precice-build # copy *.deb to home/precice; we do not need the remaining files in precice-build anymore and delete them -# user with sudo rights is needed to install preCICE in debian package + +# Install preCICE as debian package (requires superuser rights) USER root RUN cd /home/precice && dpkg -i $(find . -maxdepth 1 -name "*.deb") - -# Setting preCICE environment variables USER precice + +# Set preCICE environment variables ENV PRECICE_ROOT="/home/precice/precice" From 28252d605e617e1dd5651ad5281dc0c250719031 Mon Sep 17 00:00:00 2001 From: Eder-K Date: Tue, 22 Dec 2020 11:56:53 +0100 Subject: [PATCH 3/3] Remove missplaced pip upgrades --- precice/Dockerfile.Ubuntu2004.home | 3 --- precice/Dockerfile.Ubuntu2004.package | 3 --- 2 files changed, 6 deletions(-) diff --git a/precice/Dockerfile.Ubuntu2004.home b/precice/Dockerfile.Ubuntu2004.home index cb0b7cfba..644823166 100644 --- a/precice/Dockerfile.Ubuntu2004.home +++ b/precice/Dockerfile.Ubuntu2004.home @@ -44,9 +44,6 @@ ENV LC_ALL en_US.UTF-8 USER precice -# Upgrade pip to latest version -RUN pip3 install --user --upgrade pip - # Rebuild image from here on if `force_rebuild` is enabled ARG CACHEBUST diff --git a/precice/Dockerfile.Ubuntu2004.package b/precice/Dockerfile.Ubuntu2004.package index b1dbe3724..f9d024196 100644 --- a/precice/Dockerfile.Ubuntu2004.package +++ b/precice/Dockerfile.Ubuntu2004.package @@ -44,9 +44,6 @@ ENV LC_ALL en_US.UTF-8 USER precice -# Upgrade pip to latest version -RUN pip3 install --user --upgrade pip - # Rebuild image from here on if `force_rebuild` is enabled ARG CACHEBUST