@@ -7,17 +7,17 @@ USER root
77# suppress warnings
88ENV DEBIAN_FRONTEND=noninteractive
99COPY docker/raw-ubuntu.sh /opt/scripts/
10- RUN bash /opt/scripts/raw-ubuntu.sh
10+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked bash /opt/scripts/raw-ubuntu.sh
1111# ENV LC_ALL=en_GB.UTF-8
1212ENV LANG=en_GB.UTF-8
1313ENV LANGUAGE=en_GB:en
1414
1515COPY docker/build_gadgetron-ubuntu.sh /opt/scripts/
16- RUN bash /opt/scripts/build_gadgetron-ubuntu.sh
16+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked bash /opt/scripts/build_gadgetron-ubuntu.sh
1717
1818# SIRF external deps
1919COPY docker/build_system-ubuntu.sh /opt/scripts/
20- RUN bash /opt/scripts/build_system-ubuntu.sh
20+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked bash /opt/scripts/build_system-ubuntu.sh
2121
2222# SIRF python deps
2323ARG BUILD_GPU=0
@@ -35,13 +35,12 @@ RUN if test "$BUILD_GPU" != 0; then \
3535FROM base AS build
3636
3737COPY docker/update_nvidia_keys.sh /opt/scripts/
38- RUN bash /opt/scripts/update_nvidia_keys.sh
38+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked bash /opt/scripts/update_nvidia_keys.sh
3939
4040COPY docker/build_essential-ubuntu.sh /opt/scripts/
41- RUN bash /opt/scripts/build_essential-ubuntu.sh
41+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked bash /opt/scripts/build_essential-ubuntu.sh
4242
4343# ccache
44- COPY --link docker/devel/.ccache/ /opt/ccache/
4544RUN ccache -o cache_dir=/opt/ccache
4645ENV PATH="/usr/lib/ccache:${PATH}"
4746
@@ -72,7 +71,7 @@ ARG EXTRA_BUILD_FLAGS=""
7271
7372# build, install in /opt/SIRF-SuperBuild/{INSTALL,sources/SIRF}, test (if RUN_CTEST)
7473COPY docker/user_sirf-ubuntu.sh /opt/scripts/
75- RUN BUILD_FLAGS="-G Ninja\
74+ RUN --mount=type=cache,target=/opt/ccache BUILD_FLAGS="-G Ninja\
7675 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}\
7776 -DSTIR_ENABLE_OPENMP=${STIR_ENABLE_OPENMP}\
7877 -DSTIR_DISABLE_HDF5=${STIR_DISABLE_HDF5}\
@@ -97,12 +96,10 @@ RUN RUN_BUILD=0 \
9796 bash /opt/scripts/user_sirf-ubuntu.sh \
9897 && fix-permissions /opt/SIRF-SuperBuild /opt/ccache
9998
100- FROM base AS sirf
101-
10299# X11 forwarding
103- RUN apt update -qq && apt install -yq --no-install-recommends \
100+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt update -qq && apt install -yq --no-install-recommends \
104101 libx11-xcb1 \
105- && apt clean \
102+ && rm -rf /var/lib/apt/lists \
106103 && mkdir -p /usr/share/X11/xkb \
107104 && test -e /usr/bin/X || ln -s /usr/bin/Xorg /usr/bin/X
108105
@@ -111,6 +108,34 @@ RUN echo 'test -z "$OMP_NUM_THREADS" && export OMP_NUM_THREADS=$(python -c "impo
111108COPY --chown=${NB_USER} --chmod=644 --link docker/.bashrc /home/${NB_USER}/
112109# RUN sed -i s:PYTHON_INSTALL_DIR:${CONDA_DIR}:g /home/${NB_USER}/.bashrc
113110
111+ # docker-stacks notebook
112+ # ENV DOCKER_STACKS_JUPYTER_CMD="notebook"
113+ ENV RESTARTABLE="yes"
114+ # ENV USE_HTTPS="yes"
115+ # gadgetron
116+ EXPOSE 9002
117+ ENV GADGETRON_RELAY_HOST="0.0.0.0"
118+ COPY --link docker/15source-sirf.sh docker/25clone-work.sh docker/35gadgetron.sh /usr/local/bin/before-notebook.d/
119+ ENV NOTEBOOK_ARGS=--PasswordIdentityProvider.hashed_password='sha1:cbf03843d2bb:8729d2fbec60cacf6485758752789cd9989e756c'
120+
121+ # copy ccache from cache mount
122+ RUN --mount=type=cache,target=/opt/ccache cp -a /opt/ccache /opt/tmp-ccache
123+ RUN rm -rf /opt/ccache && mv /opt/tmp-ccache /opt/ccache && fix-permissions /opt/ccache
124+
125+ FROM build AS sirf-dev
126+
127+ # install {SIRF-Exercises,CIL-Demos}
128+ COPY docker/user_demos.sh /opt/scripts/
129+ ARG BUILD_GPU
130+ RUN BUILD_GPU=${BUILD_GPU} bash /opt/scripts/user_demos.sh \
131+ && fix-permissions /opt/SIRF-Exercises /opt/CIL-Demos "${CONDA_DIR}" /home/${NB_USER}
132+
133+ # docker-stacks notebook
134+ USER ${NB_UID}
135+ ENV DEBIAN_FRONTEND=''
136+
137+ FROM base AS sirf
138+
114139# install from build
115140COPY --from=build --link --chown=${NB_USER} /opt/SIRF-SuperBuild/INSTALL/ /opt/SIRF-SuperBuild/INSTALL/
116141# COPY --from=build --link --chown=${NB_USER} /opt/SIRF-SuperBuild/sources/SIRF/ /opt/SIRF-SuperBuild/sources/SIRF/
@@ -126,13 +151,3 @@ RUN BUILD_GPU=${BUILD_GPU} bash /opt/scripts/user_demos.sh \
126151# docker-stacks notebook
127152USER ${NB_UID}
128153ENV DEBIAN_FRONTEND=''
129- # ENV DOCKER_STACKS_JUPYTER_CMD="notebook"
130- ENV RESTARTABLE="yes"
131- # ENV USE_HTTPS="yes"
132- # gadgetron
133- EXPOSE 9002
134- ENV GADGETRON_RELAY_HOST="0.0.0.0"
135-
136- # COPY --from=build --link --chown=${NB_USER} /opt/SIRF-SuperBuild/INSTALL/lib /opt/conda/lib
137- COPY --link docker/15source-sirf.sh docker/25clone-work.sh docker/35gadgetron.sh /usr/local/bin/before-notebook.d/
138- ENV NOTEBOOK_ARGS=--PasswordIdentityProvider.hashed_password='sha1:cbf03843d2bb:8729d2fbec60cacf6485758752789cd9989e756c'
0 commit comments