Skip to content

Commit

Permalink
add mounts for cache and bind
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVCaron committed Nov 26, 2024
1 parent 352f65e commit 3f519be
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 35 deletions.
7 changes: 3 additions & 4 deletions containers/dmriqcpy.context/dmriqcpy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
python3-dev && \
rm -rf /var/lib/apt/lists/*

RUN locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8

RUN python${PYTHON_VERSION} -m pip install \
RUN --mount=type=cache,sharing=locked,target=/root/.cache/pip \
echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen && \
python${PYTHON_VERSION} -m pip install \
git+https://github.com/scilus/dmriqcpy.git@${DMRIQCPY_REVISION} && \
python${PYTHON_VERSION} -m pip cache purge && \
sed -i '41s/.*/backend : Agg/' /usr/local/lib/python${PYTHON_VERSION}/${PYTHON_PACKAGE_DIR}/matplotlib/mpl-data/matplotlibrc && \
Expand Down
41 changes: 20 additions & 21 deletions containers/fsl.context/fsl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,34 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
git \
&& rm -rf /var/lib/apt/lists/*

RUN echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen

ADD --link https://git.fmrib.ox.ac.uk/fsl/conda/installer/-/raw/${FSL_INSTALLER_VERSION}/fsl/installer/fslinstaller.py /fsl_build/fslinstaller.py

WORKDIR /fsl_build
RUN --mount=type=bind,source=./manifest.json,target=/fsl_build/manifest.json \
--mount=type=cache,sharing=locked,target=/root/.cache/pip \
echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen && \
python fslinstaller.py \
-d ${FSL_INSTALL_PATH} \
-V ${FSL_VERSION} \
--manifest manifest.json \
-n -o || (cd /root && cat $(ls | grep fsl_installation) && exit 1)

RUN rm -rf ${FSL_INSTALL_PATH}/cmake \
${FSL_INSTALL_PATH}/compiler_compat \
${FSL_INSTALL_PATH}/config \
${FSL_INSTALL_PATH}/doc \
${FSL_INSTALL_PATH}/docs \
${FSL_INSTALL_PATH}/envs \
${FSL_INSTALL_PATH}/fonts \
${FSL_INSTALL_PATH}/include \
${FSL_INSTALL_PATH}/man \
${FSL_INSTALL_PATH}/mkspecs \
${FSL_INSTALL_PATH}/phrasebooks \
${FSL_INSTALL_PATH}/qml \
${FSL_INSTALL_PATH}/shell \
${FSL_INSTALL_PATH}/src \
${FSL_INSTALL_PATH}/tcl \
${FSL_INSTALL_PATH}/translations \
${FSL_INSTALL_PATH}/var
-n -o || (cd /root && cat $(ls | grep fsl_installation) && exit 1) && \
rm -rf ${FSL_INSTALL_PATH}/cmake \
${FSL_INSTALL_PATH}/compiler_compat \
${FSL_INSTALL_PATH}/config \
${FSL_INSTALL_PATH}/doc \
${FSL_INSTALL_PATH}/docs \
${FSL_INSTALL_PATH}/envs \
${FSL_INSTALL_PATH}/fonts \
${FSL_INSTALL_PATH}/include \
${FSL_INSTALL_PATH}/man \
${FSL_INSTALL_PATH}/mkspecs \
${FSL_INSTALL_PATH}/phrasebooks \
${FSL_INSTALL_PATH}/qml \
${FSL_INSTALL_PATH}/shell \
${FSL_INSTALL_PATH}/src \
${FSL_INSTALL_PATH}/tcl \
${FSL_INSTALL_PATH}/translations \
${FSL_INSTALL_PATH}/var

FROM fsl-base AS fsl-install

Expand Down
7 changes: 3 additions & 4 deletions containers/scilpy.context/scilpy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
wget && \
rm -rf /var/lib/apt/lists/*

RUN locale-gen "en_US.UTF-8" && \
update-locale LANG=en_US.UTF-8

WORKDIR /
ADD --link https://github.com/scilus/scilpy.git#${SCILPY_REVISION} /scilpy

WORKDIR /scilpy
RUN python${PYTHON_VERSION} -m pip install "packaging<22.0" "setuptools<=70.0" && \
RUN --mount=type=cache,sharing=locked,target=/root/.cache/pip \
echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen && \
python${PYTHON_VERSION} -m pip install "packaging<22.0" "setuptools<=70.0" && \
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True python${PYTHON_VERSION} -m pip install \
pyopencl==2023.1.3 -e . && \
python${PYTHON_VERSION} -m pip cache purge
Expand Down
1 change: 1 addition & 0 deletions containers/scilus.context/scilus-base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ENV PYTHON_VERSION=${PYTHON_VERSION:-3.10}

WORKDIR /
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,sharing=locked,target=/root/.cache/pip \
export PYTHON_MAJOR=${PYTHON_VERSION%%.*} && \
if [ "$PYTHON_MAJOR" = "3" ]; then export PYTHON_MOD=3; fi && \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
Expand Down
7 changes: 3 additions & 4 deletions containers/scilus.context/scilus.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ ENV LC_ALL="en_US.UTF-8"
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US.UTF-8"

RUN locale-gen "en_US.UTF-8" && \
update-locale LANG=en_US.UTF-8

WORKDIR /tmp
RUN wget https://github.com/scilus/scilpy/releases/download/${SCILPY_VERSION}/requirements.${SCILPY_VERSION}.frozen; \
exit 0
RUN if [ -f requirements.${SCILPY_VERSION}.frozen ]; \
RUN --mount=type=cache,sharing=locked,target=/root/.cache/pip \
echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen && \
if [ -f requirements.${SCILPY_VERSION}.frozen ]; \
then \
python${PYTHON_VERSION} -m pip install -r requirements.${SCILPY_VERSION}.frozen && \
rm requirements.${SCILPY_VERSION}.frozen; \
Expand Down
3 changes: 2 additions & 1 deletion containers/vtk-omesa.context/vtk-omesa.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ COPY --from=vtk --link ${VTK_INSTALL_PATH} ${VTK_INSTALL_PATH}
COPY --from=vtk --link ${WHEELHOUSE_PATH} ${WHEELHOUSE_PATH}

WORKDIR /
RUN python${VTK_PYTHON_VERSION} -m pip config --global set install.find-links ${WHEELHOUSE_PATH} && \
RUN --mount=type=cache,sharing=locked,target=/root/.cache/pip \
python${VTK_PYTHON_VERSION} -m pip config --global set install.find-links ${WHEELHOUSE_PATH} && \
python${VTK_PYTHON_VERSION} -m pip install vtk==${VTK_VERSION}


Expand Down
2 changes: 1 addition & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ target "dmriqcpy-test" {
}

target "pytest-base" {
dockerfile-inline = "FROM test-base\nCOPY /tests /tests\nWORKDIR /tests\nRUN python3 -m pip install pytest pytest_console_scripts && python3 -m pytest"
dockerfile-inline = "FROM test-base\nWORKDIR /tests\nRUN --mount=type=bind,source=./tests,target=/tests --mount=type=cache,sharing=locked,target=/root/.cache/pip python3 -m pip install pytest pytest_console_scripts && python3 -m pytest"
output = ["type=cacheonly"]
}

Expand Down

0 comments on commit 3f519be

Please sign in to comment.