From 987c16eeeb348a28b6c48c8927c7a0465daf2a2d Mon Sep 17 00:00:00 2001 From: Michael Pilosov Date: Sun, 26 Dec 2021 12:49:40 -0700 Subject: [PATCH] shrink image size by 37% on bullseye, 40% on buster --- Dockerfile | 46 +++++++++----------- patches.patch | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 25 deletions(-) create mode 100644 patches.patch diff --git a/Dockerfile b/Dockerfile index 824492a..1d78794 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,8 +20,8 @@ RUN apt-get update -yqq && \ rm -rf /var/lib/apt/lists/* # fenics -RUN git config --global user.email mm@clfx.cc -RUN git config --global user.name mm +RUN git config --global user.email fenics@dockerhost +RUN git config --global user.name fenics RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ git clone https://bitbucket.org/fenics-project/ufl && \ @@ -36,29 +36,25 @@ RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ pip install . && cd .. && \ rm -rf /tmp/src/* -#RUN apt-get update -yqq && apt-get install libopenmpi-dev -RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ - git clone https://bitbucket.org/fenics-project/dolfin -COPY patches.patch /tmp/src/dolfin/ -RUN cd /tmp/src/dolfin && \ - git checkout 3eacdb46ed4e6dcdcbfb3b2f5eefa73f32e1b8a8 && \ - git am patches.patch && \ - cd .. && \ - mkdir dolfin/build && cd dolfin/build && \ - cmake .. && make install - ENV PYBIND11_VERSION=2.4.3 - RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \ tar -xf v${PYBIND11_VERSION}.tar.gz && \ cd pybind11-${PYBIND11_VERSION} && \ mkdir build && cd build && \ - cmake -DPYBIND11_TEST=off .. && make install && \ - rm -rf v${PYBIND11_VERSION}.tar.gz + cmake -DPYBIND11_TEST=off .. && make install && cd / && \ + rm -rf /tmp/src/* -RUN cd /tmp/src/dolfin/python && \ - pip3 install . +COPY patches.patch /tmp/latest.patch +RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ + git clone https://bitbucket.org/fenics-project/dolfin && \ + cd dolfin && \ + git checkout 3eacdb46ed4e6dcdcbfb3b2f5eefa73f32e1b8a8 && \ + git am /tmp/latest.patch && \ + mkdir build && cd build && \ + cmake .. && make install && cd .. && \ + cd python && pip3 install . && cd / && \ + rm -rf /tmp/src/* # mshr RUN apt-get update -yqq && \ @@ -70,14 +66,14 @@ RUN apt-get update -yqq && \ apt-get -qq clean && \ rm -rf /var/lib/apt/lists/* -RUN cd /tmp/src/ && \ +RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \ git clone https://bitbucket.org/fenics-project/mshr && \ - cd mshr && git checkout c27eb18f47cb35d27c863c2db584915659e64c7f && cd .. && \ + cd mshr && \ + git checkout c27eb18f47cb35d27c863c2db584915659e64c7f && \ . /usr/local/share/dolfin/dolfin.conf && \ - mkdir mshr/build && cd mshr/build && \ - cmake .. && make install - -RUN cd /tmp/src/mshr/python && \ - pip3 install . + mkdir build && cd build && \ + cmake .. && make install && cd .. && \ + cd python && pip3 install . && cd / && \ + rm -rf /tmp/src/* RUN echo ". /usr/local/share/dolfin/dolfin.conf" >> /root/.bashrc diff --git a/patches.patch b/patches.patch new file mode 100644 index 0000000..c68e00e --- /dev/null +++ b/patches.patch @@ -0,0 +1,117 @@ +From 7f90c25d4e8ff48cbd0241afb74f530392408f74 Mon Sep 17 00:00:00 2001 +From: mm +Date: Sun, 26 Dec 2021 18:56:23 +0000 +Subject: [PATCH] apply patches for bullseye + +--- + cmake/modules/FindPETSc.cmake | 2 +- + cmake/modules/FindSLEPc.cmake | 2 +- + dolfin/geometry/IntersectionConstruction.cpp | 1 + + dolfin/io/VTKFile.cpp | 5 ++--- + dolfin/io/VTKWriter.cpp | 1 - + dolfin/mesh/MeshFunction.h | 1 + + python/setup.py | 2 +- + 7 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/cmake/modules/FindPETSc.cmake b/cmake/modules/FindPETSc.cmake +index 80faffdad..728a6ec30 100644 +--- a/cmake/modules/FindPETSc.cmake ++++ b/cmake/modules/FindPETSc.cmake +@@ -51,7 +51,7 @@ find_package(PkgConfig REQUIRED) + + # Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems + set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") +-pkg_search_module(PETSC craypetsc_real PETSc) ++pkg_search_module(PETSC craypetsc_real petsc PETSc) + + # Extract major, minor, etc from version string + if (PETSC_VERSION) +diff --git a/cmake/modules/FindSLEPc.cmake b/cmake/modules/FindSLEPc.cmake +index 327cffc23..dec26fcc4 100644 +--- a/cmake/modules/FindSLEPc.cmake ++++ b/cmake/modules/FindSLEPc.cmake +@@ -48,7 +48,7 @@ find_package(PkgConfig REQUIRED) + set(ENV{PKG_CONFIG_PATH} "$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}") +-pkg_search_module(SLEPC crayslepc_real SLEPc) ++pkg_search_module(SLEPC crayslepc_real slepc SLEPc) + + # Extract major, minor, etc from version string + if (SLEPC_VERSION) +diff --git a/dolfin/geometry/IntersectionConstruction.cpp b/dolfin/geometry/IntersectionConstruction.cpp +index 765dbb674..7ba99a8a8 100644 +--- a/dolfin/geometry/IntersectionConstruction.cpp ++++ b/dolfin/geometry/IntersectionConstruction.cpp +@@ -18,6 +18,7 @@ + // First added: 2014-02-03 + // Last changed: 2017-12-12 + ++#include + #include + #include + #include "predicates.h" +diff --git a/dolfin/io/VTKFile.cpp b/dolfin/io/VTKFile.cpp +index 2fee53b7b..4dba84d1c 100644 +--- a/dolfin/io/VTKFile.cpp ++++ b/dolfin/io/VTKFile.cpp +@@ -20,7 +20,6 @@ + #include + #include + #include +-#include + + #include "pugixml.hpp" + +@@ -614,9 +613,9 @@ void VTKFile::vtk_header_open(std::size_t num_vertices, std::size_t num_cells, + std::string endianness = ""; + if (encode_string == "binary") + { +- #if defined BOOST_LITTLE_ENDIAN ++ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + endianness = "byte_order=\"LittleEndian\""; +- #elif defined BOOST_BIG_ENDIAN ++ #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + endianness = "byte_order=\"BigEndian\"";; + #else + dolfin_error("VTKFile.cpp", +diff --git a/dolfin/io/VTKWriter.cpp b/dolfin/io/VTKWriter.cpp +index eff693472..b57a66583 100644 +--- a/dolfin/io/VTKWriter.cpp ++++ b/dolfin/io/VTKWriter.cpp +@@ -24,7 +24,6 @@ + #include + #include + #include +-#include + + #include + #include +diff --git a/dolfin/mesh/MeshFunction.h b/dolfin/mesh/MeshFunction.h +index d29c13b4a..2fab186c7 100644 +--- a/dolfin/mesh/MeshFunction.h ++++ b/dolfin/mesh/MeshFunction.h +@@ -27,6 +27,7 @@ + #include + #include + ++#include + #include + #include + #include +diff --git a/python/setup.py b/python/setup.py +index 5105d14a0..c9308f72b 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -15,7 +15,7 @@ if sys.version_info < (3, 5): + + VERSION = "2019.2.0.dev0" + RESTRICT_REQUIREMENTS = ">=2019.2.0.dev0,<2019.3" +-UFL_RESTRICT_REQUIREMENTS = ">=2021.1.0" # UFL 2019.2.0.dev0 does not exist ++UFL_RESTRICT_REQUIREMENTS = ">=2019.2.0.dev0" # UFL 2019.2.0.dev0 does not exist + + REQUIREMENTS = ["numpy", + "pkgconfig", +-- +2.30.2 +