Skip to content

Commit c349e76

Browse files
committed
Update Dockerfile to pin numpy version for GTSAM compatibility and streamline runtime library installation
1 parent 27e2dba commit c349e76

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

Dockerfile

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ COPY --from=gtsam-clone /usr/src/gtsam /usr/src/gtsam
7474

7575
WORKDIR /usr/src/gtsam/build
7676

77-
# Install python wrapper requirements
78-
RUN python3 -m pip install --no-cache-dir -U -r /usr/src/gtsam/python/requirements.txt
77+
# Install python wrapper requirements, then pin numpy for GTSAM ABI compatibility
78+
RUN python3 -m pip install --no-cache-dir -U -r /usr/src/gtsam/python/requirements.txt && \
79+
python3 -m pip install --no-cache-dir "numpy==1.26.4"
7980

8081
# Run cmake
8182
RUN cmake \
@@ -93,8 +94,8 @@ RUN cmake \
9394
# Build, install, strip binaries, and clean in one layer to reduce image size
9495
RUN make -j$(nproc) install && \
9596
make python-install && \
96-
find /usr/local -type f \( -name "*.so" -o -name "*.so.*" \) -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
97-
find /usr/local/bin /usr/local/lib -executable -type f -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
97+
#find /usr/local -type f \( -name "*.so" -o -name "*.so.*" \) -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
98+
#find /usr/local/bin /usr/local/lib -executable -type f -exec strip --strip-unneeded {} \; 2>/dev/null || true && \
9899
make clean && \
99100
ldconfig
100101

@@ -110,28 +111,14 @@ ENV DEBIAN_FRONTEND=noninteractive
110111
ENV PATH="/usr/local/bin:${PATH}"
111112
ENV LD_LIBRARY_PATH=/usr/local/lib
112113

113-
# Runtime libs only (no -dev, no build-essential). Match what Python + GTSAM link to.
114-
# Verify with: ldd /usr/local/lib/libgtsam.so /usr/local/bin/python3.11 (in build image)
114+
# Runtime libs only. Python binary (ldd python3.11) needs only libc/libm/libpython; GTSAM needs Boost + TBB (see scripts/audit-runtime-deps.sh).
115+
# Add back libssl3t64 libbz2-1.0 libreadline8t64 libsqlite3-0 libffi8 zlib1g libncursesw6 if you import ssl/sqlite3/readline/etc.
115116
RUN apt-get update && apt-get install -y --no-install-recommends \
116117
ca-certificates \
117-
libssl3t64 \
118-
libbz2-1.0 \
119-
libreadline8t64 \
120-
libsqlite3-0 \
121-
libffi8 \
122-
zlib1g \
123-
libncursesw6 \
124118
libtbb12 \
125-
libgmp10 \
126-
libmpfr6 \
127-
libmpc3 \
119+
libtbbmalloc2 \
128120
libboost-serialization1.83.0 \
129-
libboost-system1.83.0 \
130-
libboost-thread1.83.0 \
131-
libboost-date-time1.83.0 \
132121
libboost-filesystem1.83.0 \
133-
libboost-chrono1.83.0 \
134-
libboost-atomic1.83.0 \
135122
libboost-timer1.83.0 \
136123
&& rm -rf /var/lib/apt/lists/*
137124

0 commit comments

Comments
 (0)