|
1 | | -FROM ubuntu:22.04 |
| 1 | +# ── Stage 1: Build STIR ────────────────────────────────────────────────────── |
| 2 | +FROM ubuntu:22.04 AS builder |
2 | 3 |
|
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/* |
16 | 10 |
|
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 |
19 | 12 |
|
| 13 | +RUN git clone https://github.com/UCL/STIR \ |
| 14 | + && cd STIR \ |
| 15 | + && git checkout 46da4ef2b8b38487b08f5aa48c6e38b568a584cc |
20 | 16 |
|
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 |
24 | 24 |
|
| 25 | +RUN pip install --no-cache-dir nibabel scipy |
25 | 26 |
|
| 27 | +# ── Stage 2: Runtime ───────────────────────────────────────────────────────── |
| 28 | +FROM ubuntu:22.04 |
26 | 29 |
|
| 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 |
27 | 46 |
|
28 | | -# Copy recon folder |
29 | 47 | WORKDIR /recon |
30 | 48 | COPY . . |
31 | 49 |
|
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 |
39 | 50 | ENV PYTHONPATH="/usr/local/python" |
40 | 51 | ENV OVERWRITE="" |
41 | 52 |
|
|
0 commit comments