-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (46 loc) · 1.65 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ARG PYTHON_VERSION=3.11.2
# Get the base python image from Docker Hub
FROM python:${PYTHON_VERSION}-bullseye as dependencies
# Disable GUI prompts
ENV DEBIAN_FRONTEND noninteractive
# Update apps on the base image and install necessary packages
RUN apt-get -y update && \
apt-get -y install build-essential apt-utils libboost-all-dev cmake libtbb-dev && \
rm -rf /var/lib/apt/lists/*
# Use git to clone gtsam and specific GTSAM version
FROM alpine/git:2.45.2 as gtsam-clone
ARG GTSAM_VERSION=4.2.0
WORKDIR /usr/src/
# Clone GTSAM and checkout to given GTSAM_VERSION tag
RUN git clone --no-checkout https://github.com/borglab/gtsam.git && \
cd gtsam && \
git fetch origin tag ${GTSAM_VERSION} && \
git checkout ${GTSAM_VERSION}
# Create new stage called gtsam for GTSAM building
FROM dependencies as gtsam
# Move gtsam data
COPY --from=gtsam-clone /usr/src/gtsam /usr/src/gtsam
WORKDIR /usr/src/gtsam/build
# Needed to link with GTSAM
RUN echo 'export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH' >> /root/.bashrc
# Install python wrapper requirements
RUN python3 -m pip install -U -r /usr/src/gtsam/python/requirements.txt
# Run cmake
RUN cmake \
-DCMAKE_BUILD_TYPE=Release \
-DGTSAM_WITH_EIGEN_MKL=OFF \
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
-DGTSAM_BUILD_TIMING_ALWAYS=OFF \
-DGTSAM_BUILD_TESTS=OFF \
-DGTSAM_BUILD_PYTHON=ON \
-DGTSAM_BUILD_CONVENIENCE_LIBRARIES=OFF \
-DGTSAM_PYTHON_VERSION=${PYTHON_VERSION} \
..
# Make install and clean up
RUN make -j4 install && \
make python-install && \
make clean
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN ldconfig
CMD ["bash"]