Skip to content

Commit 2851da8

Browse files
committed
feat: Update multistage Dockerfiles to adjust build and test order, and add optional Python bindings copying
1 parent 85669ce commit 2851da8

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

feelpp-mor/Dockerfile.multistage

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ RUN git config --global user.name "Docker Robot" && \
5858

5959
WORKDIR /src/feelpp
6060

61-
# Configure, build, test, install, and cleanup in a SINGLE layer to minimize image size
62-
# Tests run BEFORE install (they use build paths, not install paths)
61+
# Configure, build, install, test, and cleanup in a SINGLE layer to minimize image size
62+
# Install runs BEFORE tests so tests use installed paths
6363
RUN cmake --preset mor \
6464
-DCMAKE_BUILD_TYPE=Release \
6565
-DCMAKE_INSTALL_PREFIX=/usr/local \
6666
-DCMAKE_CXX_COMPILER=${CXX} \
6767
-DCMAKE_C_COMPILER=${CC} \
6868
${CMAKE_FLAGS} && \
6969
cmake --build --preset mor && \
70-
(ctest --preset mor || true) && \
71-
cmake --install build/mor && \
70+
cmake --build --preset mor -t install && \
7271
ldconfig && \
72+
(ctest --preset mor || true) && \
7373
rm -rf build/mor /root/feelppdb /root/.cache /feel
7474

7575
# =============================================================================
@@ -108,11 +108,17 @@ COPY --from=builder /usr/local/include/feelpp/feel/feelmor /usr/local/include/fe
108108
# Copy MOR CMake and data files
109109
COPY --from=builder /usr/local/share/feelpp/mor /usr/local/share/feelpp/mor
110110

111+
# Copy Python bindings for MOR (optional, may not exist if Python disabled)
112+
RUN --mount=from=builder,source=/usr/local,target=/mnt/builder \
113+
mkdir -p /usr/local/lib/python3/dist-packages && \
114+
cp -r /mnt/builder/lib/python3/dist-packages/feelpp* /usr/local/lib/python3/dist-packages/ 2>/dev/null || true
115+
111116
# Update library cache
112117
RUN ldconfig
113118

114119
USER feelpp
115120
ENV HOME=/home/feelpp
116121
ENV FEELPP_REPOSITORY=/feel
122+
ENV PYTHONPATH=/usr/local/lib/python3/dist-packages:${PYTHONPATH}
117123
WORKDIR ${HOME}
118124
CMD ["/bin/bash"]

feelpp-toolboxes/Dockerfile.multistage

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ RUN git config --global user.name "Docker Robot" && \
5858

5959
WORKDIR /src/feelpp
6060

61-
# Configure, build, test, install, and cleanup in a SINGLE layer to minimize image size
62-
# Tests run BEFORE install (they use build paths, not install paths)
61+
# Configure, build, install, test, and cleanup in a SINGLE layer to minimize image size
62+
# Install runs BEFORE tests so tests use installed paths
6363
RUN cmake --preset toolboxes \
6464
-DCMAKE_BUILD_TYPE=Release \
6565
-DCMAKE_INSTALL_PREFIX=/usr/local \
6666
-DCMAKE_CXX_COMPILER=${CXX} \
6767
-DCMAKE_C_COMPILER=${CC} \
6868
${CMAKE_FLAGS} && \
6969
cmake --build --preset toolboxes && \
70-
(ctest --preset toolboxes || true) && \
71-
cmake --install build/toolboxes && \
70+
cmake --build --preset toolboxes -t install && \
7271
ldconfig && \
72+
(ctest --preset toolboxes || true) && \
7373
rm -rf build/toolboxes /root/feelppdb /root/.cache /feel
7474

7575
# =============================================================================
@@ -100,11 +100,17 @@ RUN --mount=from=builder,source=/usr/local,target=/mnt/builder \
100100
cp /mnt/builder/bin/feelpp_toolbox* /usr/local/bin/ 2>/dev/null || true && \
101101
cp /mnt/builder/lib/libfeelpp_toolbox* /usr/local/lib/ 2>/dev/null || true
102102

103+
# Copy Python bindings for toolboxes (optional, may not exist if Python disabled)
104+
RUN --mount=from=builder,source=/usr/local,target=/mnt/builder \
105+
mkdir -p /usr/local/lib/python3/dist-packages && \
106+
cp -r /mnt/builder/lib/python3/dist-packages/feelpp* /usr/local/lib/python3/dist-packages/ 2>/dev/null || true
107+
103108
# Update library cache
104109
RUN ldconfig
105110

106111
USER feelpp
107112
ENV HOME=/home/feelpp
108113
ENV FEELPP_REPOSITORY=/feel
114+
ENV PYTHONPATH=/usr/local/lib/python3/dist-packages:${PYTHONPATH}
109115
WORKDIR ${HOME}
110116
CMD ["/bin/bash"]

feelpp/Dockerfile.full

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ RUN git config --global user.name "Docker Robot" && \
6060

6161
WORKDIR /src/feelpp
6262

63-
# Configure, build, test, install, and cleanup in a SINGLE layer to minimize image size
64-
# Tests run BEFORE install (they use build paths, not install paths)
63+
# Configure, build, install, test, and cleanup in a SINGLE layer to minimize image size
64+
# Install runs BEFORE tests so tests use installed paths
6565
RUN cmake --preset default \
6666
-DCMAKE_INSTALL_PREFIX=/usr/local \
6767
-DCMAKE_BUILD_TYPE=Release \
@@ -70,9 +70,9 @@ RUN cmake --preset default \
7070
-DFEELPP_ENABLE_FEELPP_PYTHON=ON \
7171
${CMAKE_FLAGS} && \
7272
cmake --build --preset default && \
73-
ctest --preset default || true && \
74-
cmake --install build/default && \
73+
cmake --build --preset default -t install && \
7574
ldconfig && \
75+
ctest --preset default || true && \
7676
rm -rf build/default /root/feelppdb /root/.cache /feel
7777

7878
# =============================================================================

feelpp/Dockerfile.multistage

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ RUN git config --global user.name "Docker Robot" && \
5454

5555
WORKDIR /src/feelpp
5656

57-
# Configure, build, test, install, and cleanup in a SINGLE layer to minimize image size
58-
# Tests run BEFORE install (they use build paths, not install paths)
57+
# Configure, build, install, test, and cleanup in a SINGLE layer to minimize image size
58+
# Install runs BEFORE tests so tests use installed paths
5959
RUN cmake --preset feelpp \
6060
-DCMAKE_INSTALL_PREFIX=/usr/local \
6161
-DCMAKE_BUILD_TYPE=Release \
6262
-DCMAKE_CXX_COMPILER=${CXX} \
6363
-DCMAKE_C_COMPILER=${CC} \
6464
${CMAKE_FLAGS} && \
6565
cmake --build --preset feelpp && \
66-
ctest --preset feelpp || true && \
67-
cmake --install build/feelpp && \
66+
cmake --build --preset feelpp -t install && \
6867
ldconfig && \
68+
ctest --preset feelpp || true && \
6969
rm -rf build/feelpp /root/feelppdb /root/.cache /feel
7070

7171
# =============================================================================

0 commit comments

Comments
 (0)