Skip to content

Commit

Permalink
Switch to micromamba
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Oct 27, 2023
1 parent 00cc0a4 commit 8b18853
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
25 changes: 17 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
FROM docker.io/fnndsc/pl-fetal-surface-extract:base-1
FROM docker.io/fnndsc/pl-fetal-surface-extract:base-2

LABEL org.opencontainers.image.authors="Jennings Zhang <[email protected]>" \
org.opencontainers.image.title="pl-fetal-surface-extract" \
org.opencontainers.image.description="Fetal brain MRI surface extraction using CIVET marching-cubes"

WORKDIR /usr/local/src/pl-fetal-surface-extract
RUN \
--mount=type=cache,sharing=private,target=/home/mambauser/.mamba/pkgs,uid=57439,gid=57439 \
--mount=type=cache,sharing=private,target=/opt/conda/pkgs,uid=57439,gid=57439 \
micromamba install -y -n base -c conda-forge python=3.11.5 numpy=1.26.0

RUN conda install -c conda-forge -y numpy=1.22.3
ARG SRCDIR=/home/mambauser/pl-fetal-surface-extract
ARG MAMBA_DOCKERFILE_ACTIVATE=1
WORKDIR ${SRCDIR}

COPY requirements.txt .
RUN pip install -r requirements.txt
COPY --chown=57439:57439 requirements.txt .
RUN --mount=type=cache,sharing=private,target=/home/mambauser/.cache/pip,uid=57439,gid=57439 \
pip install -r requirements.txt

COPY . .
RUN pip install .
COPY --chown=mambauser:mambauser . .
ARG extras_require=none
RUN pip install ".[${extras_require}]" \
&& cd / && rm -rf ${SRCDIR}
WORKDIR /

CMD ["extract_cp", "--help"]
CMD ["extract_cp"]
12 changes: 11 additions & 1 deletion base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,20 @@ RUN cp -r /opt/CIVET/dist/perl /microminc/perl
RUN mkdir -vp /microminc/share \
&& cp -rv "$MNI_DATAPATH/surface-extraction" "/microminc/share"

FROM fnndsc/conda:python3.11.2
FROM ghcr.io/mamba-org/micromamba:1.5.1-bookworm-slim

USER root
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& apt-get -y --no-install-recommends install perl

COPY --from=builder /microminc /opt/microminc
ENV PATH=/opt/microminc/bin:$PATH \
LD_LIBRARY_PATH=/opt/microminc/lib:$LD_LIBRARY_PATH \
MINC_FORCE_V2=1 MINC_COMPRESS=4 VOLUME_CACHE_THRESHOLD=-1 \
MNI_DATAPATH=/opt/microminc/share \
PERL5LIB=/opt/microminc/perl

USER mambauser
2 changes: 1 addition & 1 deletion base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
exec docker buildx build --push \
--platform linux/amd64,linux/arm64,linux/ppc64le \
--build-arg http_proxy=$http_proxy \
-t docker.io/fnndsc/pl-fetal-surface-extract:base-1 .
-t docker.io/fnndsc/pl-fetal-surface-extract:base-2 .
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ chris_plugin==0.3.1
pycivet==0.1.2
loguru==0.6.0
pybicpl==0.5.1
numpy~=1.22
numpy~=1.26.0

0 comments on commit 8b18853

Please sign in to comment.