-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from nipreps-containers/enh/update-to-micromamba
ENH: Migrate to micromamba
- Loading branch information
Showing
3 changed files
with
499 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# Use Ubuntu 20.04 LTS | ||
FROM ubuntu:focal-20210416 | ||
FROM ubuntu:jammy-20240125 | ||
|
||
# Make apt non-interactive | ||
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \ | ||
|
@@ -35,6 +35,7 @@ RUN apt-get update && \ | |
build-essential \ | ||
bzip2 \ | ||
ca-certificates \ | ||
curl \ | ||
libtool \ | ||
locales \ | ||
lsb-release \ | ||
|
@@ -50,102 +51,33 @@ RUN locale-gen en_US.UTF-8 || true | |
ENV LANG="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" | ||
|
||
# Leave these args here to better use the Docker build cache | ||
# miniconda index: https://conda.io/en/latest/miniconda_hashes.html | ||
ENV CONDA_PATH="/opt/conda" | ||
ARG CONDA_VERSION=py39_23.1.0-1 | ||
ARG SHA256SUM=5dc619babc1d19d6688617966251a38d245cb93d69066ccde9a013e1ebb5bf18 | ||
WORKDIR / | ||
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba | ||
|
||
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -O miniconda.sh && \ | ||
echo "${SHA256SUM} miniconda.sh" > miniconda.sha256 && \ | ||
sha256sum -c --status miniconda.sha256 && \ | ||
mkdir -p /opt && \ | ||
sh miniconda.sh -b -p ${CONDA_PATH} && \ | ||
rm miniconda.sh miniconda.sha256 && \ | ||
ln -s ${CONDA_PATH}/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ | ||
echo ". ${CONDA_PATH}/etc/profile.d/conda.sh" >> ~/.bashrc && \ | ||
echo "conda activate base" >> ~/.bashrc && \ | ||
find ${CONDA_PATH}/ -follow -type f -name '*.a' -delete && \ | ||
find ${CONDA_PATH}/ -follow -type f -name '*.js.map' -delete && \ | ||
${CONDA_PATH}/bin/conda clean -afy | ||
|
||
# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip) | ||
ENV PATH="${CONDA_PATH}/bin:$PATH" \ | ||
CPATH="${CONDA_PATH}/include:$CPATH" \ | ||
PYTHONNOUSERSITE=1 | ||
|
||
COPY condarc /root/.condarc | ||
|
||
RUN ${CONDA_PATH}/bin/conda install mamba -n base && \ | ||
mamba install -y \ | ||
attrs=22.2 \ | ||
codecov=2.1 \ | ||
colorclass=2.2 \ | ||
coverage=6.3 \ | ||
curl=7.88 \ | ||
datalad=0.18 \ | ||
dipy=1.5 \ | ||
flake8=4.0 \ | ||
git=2.39 \ | ||
graphviz=3.0 \ | ||
h5py=3.8 \ | ||
indexed_gzip=1.7 \ | ||
jinja2=3.1 \ | ||
libxml2=2.10 \ | ||
libxslt=1.1 \ | ||
lockfile=0.12 \ | ||
matplotlib=3.5 \ | ||
mkl=2022.1 \ | ||
mkl-service=2.4 \ | ||
nibabel=4.0 \ | ||
nilearn=0.9 \ | ||
nipype=1.8 \ | ||
nitime=0.9 \ | ||
nodejs=18 \ | ||
numpy=1.24 \ | ||
packaging=23.0 \ | ||
pandas=1.5 \ | ||
pandoc=2.19 \ | ||
pbr=5.11 \ | ||
pip=23.0 \ | ||
pockets=0.9 \ | ||
psutil=5.9 \ | ||
pydot=1.4 \ | ||
pytest=7.2 \ | ||
pytest-cov=4.0 \ | ||
pytest-env=0.8 \ | ||
pytest-xdist=3.2 \ | ||
pyyaml=6.0 \ | ||
requests=2.28 \ | ||
scikit-image=0.19 \ | ||
scikit-learn=1.2 \ | ||
scipy=1.10 \ | ||
seaborn=0.12 \ | ||
setuptools=65 \ | ||
sphinx=4.5 \ | ||
sphinx_rtd_theme=1.0 \ | ||
svgutils=0.3 \ | ||
toml=0.10 \ | ||
traits=6.3 \ | ||
zlib=1.2 \ | ||
zstd=1.5; sync && \ | ||
chmod -R a+rX ${CONDA_PATH}; sync && \ | ||
chmod +x ${CONDA_PATH}/bin/*; sync && \ | ||
${CONDA_PATH}/bin/conda clean -afy && sync && \ | ||
rm -rf ~/.conda ~/.cache/pip/*; sync | ||
ENV MAMBA_ROOT_PREFIX="/opt/conda" | ||
COPY env.yml /tmp/env.yml | ||
COPY requirements.txt /tmp/requirements.txt | ||
WORKDIR /tmp | ||
RUN micromamba create -y -f /tmp/env.yml && \ | ||
micromamba clean -y -a | ||
|
||
# Precaching fonts, set 'Agg' as default backend for matplotlib | ||
RUN ${CONDA_PATH}/bin/python -c "from matplotlib import font_manager" && \ | ||
sed -i 's/\(backend *: \).*$/\1Agg/g' $( ${CONDA_PATH}/bin/python -c "import matplotlib; print(matplotlib.matplotlib_fname())" ) | ||
RUN micromamba -n base run python -c "from matplotlib import font_manager" && \ | ||
sed -i 's/\(backend *: \).*$/\1Agg/g' $( micromamba -n base run python -c "import matplotlib; print(matplotlib.matplotlib_fname())" ) | ||
|
||
# Install packages that are not distributed with conda | ||
RUN ${CONDA_PATH}/bin/python -m pip install --no-cache-dir -U \ | ||
datalad-osf \ | ||
etelemetry \ | ||
nitransforms \ | ||
templateflow \ | ||
transforms3d | ||
# UV_USE_IO_URING for apparent race-condition (https://github.com/nodejs/node/issues/48444) | ||
# Check if this is still necessary when updating the base image. | ||
ENV PATH="/opt/conda/bin:$PATH" \ | ||
UV_USE_IO_URING=0 | ||
|
||
# Installing SVGO and bids-validator | ||
RUN ${CONDA_PATH}/bin/npm install -g svgo@^2.3 bids-validator@1.8.0 && \ | ||
RUN npm install -g svgo@^3.2.0 bids-validator@^1.14.0 && \ | ||
rm -rf ~/.npm ~/.empty /root/.npm | ||
|
||
# Initialize templateflow | ||
ENV TEMPLATEFLOW_HOME=/templateflow | ||
RUN templateflow update | ||
|
||
# Pacify DataLad | ||
RUN git config --global user.name "NiPreps Miniconda" \ | ||
&& git config --global user.email "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: base | ||
channels: | ||
- conda-forge | ||
# Update this ~yearly; last updated Jan 2024 | ||
dependencies: | ||
- python=3.11 | ||
# Needed for svgo and bids-validator; consider moving to deno | ||
- nodejs=20 | ||
# Intel Math Kernel Library for numpy | ||
- mkl=2023.2.0 | ||
- mkl-service=2.4.0 | ||
# git-annex for templateflow users with DataLad superdatasets | ||
- git-annex=*=alldep* | ||
# Base scientific python stack; required by FSL, so pinned here | ||
- numpy=1.26 | ||
- scipy=1.11 | ||
- matplotlib=3.8 | ||
- pandas=2.2 | ||
- h5py=3.10 | ||
# Dependencies compiled against numpy, best to stick with conda | ||
- nitime=0.10 | ||
- scikit-image=0.22 | ||
- scikit-learn=1.4 | ||
# Utilities | ||
- graphviz=9.0 | ||
- pandoc=3.1 | ||
- pip | ||
- pip: | ||
- -r requirements.txt | ||
variables: | ||
FSLOUTPUTTYPE: NIFTI_GZ |
Oops, something went wrong.