Skip to content

Commit fbcb5e6

Browse files
Docker builder environment
1 parent 8566769 commit fbcb5e6

1 file changed

Lines changed: 38 additions & 27 deletions

File tree

src/recon/Dockerfile

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,52 @@
1-
FROM ubuntu:22.04
1+
# ── Stage 1: Build STIR ──────────────────────────────────────────────────────
2+
FROM ubuntu:22.04 AS builder
23

3-
# Install dependencies
4-
RUN apt-get update && apt-get install -y \
5-
git \
6-
cmake \
7-
build-essential \
8-
libboost-all-dev \
9-
libhdf5-dev \
10-
python3-dev \
11-
python3-pip \
12-
swig \
13-
libfftw3-dev
14-
RUN apt-get install libinsighttoolkit5-dev -y
15-
RUN apt install nlohmann-json3-dev -y
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
git cmake build-essential \
6+
libboost-all-dev libhdf5-dev libfftw3-dev \
7+
python3-dev python3-pip \
8+
swig libinsighttoolkit5-dev nlohmann-json3-dev \
9+
&& rm -rf /var/lib/apt/lists/*
1610

17-
# Clone and build STIR
18-
RUN git clone https://github.com/UCL/STIR && cd STIR && git checkout 46da4ef2b8b38487b08f5aa48c6e38b568a584cc
11+
RUN pip install --no-cache-dir numpy
1912

13+
RUN git clone https://github.com/UCL/STIR \
14+
&& cd STIR \
15+
&& git checkout 46da4ef2b8b38487b08f5aa48c6e38b568a584cc
2016

21-
RUN pip install numpy
22-
RUN mkdir build && cd build && cmake ../STIR -DBUILD_SWIG_PYTHON=ON -DSTIR_BUILD_EXECUTABLES=ON -DPython_EXECUTABLE=/usr/bin/python3 && make -j 8 && make install
23-
RUN pip install nibabel scipy
17+
RUN mkdir /build && cd /build \
18+
&& cmake /STIR \
19+
-DBUILD_SWIG_PYTHON=ON \
20+
-DSTIR_BUILD_EXECUTABLES=ON \
21+
-DPython_EXECUTABLE=/usr/bin/python3 \
22+
&& make -j$(nproc) \
23+
&& make install
2424

25+
RUN pip install --no-cache-dir nibabel scipy
2526

27+
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
28+
FROM ubuntu:22.04
2629

30+
RUN apt-get update && apt-get install -y --no-install-recommends \
31+
python3 \
32+
libboost-filesystem1.74.0 \
33+
libboost-program-options1.74.0 \
34+
libboost-regex1.74.0 \
35+
libboost-serialization1.74.0 \
36+
libboost-thread1.74.0 \
37+
libboost-iostreams1.74.0 \
38+
libboost-date-time1.74.0 \
39+
libhdf5-103 \
40+
libfftw3-double3 \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
# Copy STIR install (executables, libs, Python bindings) + pip packages
44+
COPY --from=builder /usr/local /usr/local
45+
RUN ldconfig
2746

28-
# Copy recon folder
2947
WORKDIR /recon
3048
COPY . .
3149

32-
# Mount host directories to these paths at runtime:
33-
# -v /host/recon_folder:/data/recon
34-
# -v /host/ct.nii.gz:/data/ct/ct.nii.gz
35-
# -v /host/output:/data/output
36-
# -v /host/intermediates:/data/intermediates
37-
38-
# Set OVERWRITE=1 at runtime to enable overwriting existing files
3950
ENV PYTHONPATH="/usr/local/python"
4051
ENV OVERWRITE=""
4152

0 commit comments

Comments
 (0)