Skip to content

Commit

Permalink
Merge pull request #201 from nighres/master
Browse files Browse the repository at this point in the history
update the docker file
  • Loading branch information
piloubazin committed May 7, 2024
2 parents 90f35d2 + b0403d4 commit 1464837
Showing 1 changed file with 29 additions and 214 deletions.
243 changes: 29 additions & 214 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,216 +1,31 @@
# Generated by Neurodocker and Reproenv.
# Start from the official Debian image
FROM debian:bullseye

FROM debian:stable
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
openjdk-17-jdk git wget build-essential software-properties-common libffi-dev \
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME="/docker-java-temurin-home"
ENV JCC_JDK="/docker-java-temurin-home"
RUN ln -svT "/usr/lib/jvm/java-17-openjdk-$(dpkg --print-architecture)" /docker-java-temurin-home
ENV CONDA_DIR="/opt/miniconda-latest" \
PATH="/opt/miniconda-latest/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bzip2 \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* \
# Install dependencies.
&& export PATH="/opt/miniconda-latest/bin:$PATH" \
&& echo "Downloading Miniconda installer ..." \
&& conda_installer="/tmp/miniconda.sh" \
&& curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
&& rm -f "$conda_installer" \
&& conda update -yq -nbase conda \
# Prefer packages in conda-forge
&& conda config --system --prepend channels conda-forge \
# Packages in lower-priority channels not considered if a package with the same
# name exists in a higher priority channel. Can dramatically speed up installations.
# Conda recommends this as a default
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html
&& conda config --set channel_priority strict \
&& conda config --system --set auto_update_conda false \
&& conda config --system --set show_channel_urls true \
# Enable `conda activate`
&& conda init bash \
&& conda create -y --name nighres \
&& conda install -y --name nighres \
"python=3.9" \
"pip" \
"JCC" \
"Nilearn" \
# Clean up
&& sync && conda clean --all --yes && sync \
&& rm -rf ~/.cache/pip/*
COPY ["build.sh", \
"cbstools-lib-files.sh", \
"imcntk-lib-files.sh", \
"dependencies_sha.sh", \
"setup.py", \
"setup.cfg", \
"MANIFEST.in", \
"README.rst", \
"LICENSE", \
"/nighres/"]
COPY ["nighres", \
"/nighres/nighres"]
WORKDIR /nighres
RUN conda init && . /root/.bashrc && activate nighres && conda info --envs && pip install jcc && ./build.sh && rm -rf cbstools-public imcn-imaging nighresjava/build nighresjava/src
ENV CONDA_DIR="/opt/miniconda-latest" \
PATH="/opt/miniconda-latest/bin:$PATH"
RUN conda install -y --name nighres \
"jupyterlab" \
&& bash -c "source activate nighres \
&& python -m pip install --no-cache-dir \
"."" \
# Clean up
&& sync && conda clean --all --yes && sync \
&& rm -rf ~/.cache/pip/*
COPY ["docker/jupyter_notebook_config.py", \
"/etc/jupyter"]
RUN test "$(getent passwd neuro)" \
|| useradd --no-user-group --create-home --shell /bin/bash neuro
USER neuro
WORKDIR /home/neuro
# Install necessary tools and dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git \
build-essential \
python3 \
python3-pip \
python3-dev \
libffi-dev \
openjdk-17-jdk \
wget \
&& rm -rf /var/lib/apt/lists/*

# Adjust JAVA_HOME if necessary and create a symbolic link to match JCC's expected JDK path
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
RUN ln -s $JAVA_HOME /usr/lib/jvm/temurin-17-jdk-amd64

# Install JCC
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install jcc

# Save specification to JSON.
USER root
RUN printf '{ \
"pkg_manager": "apt", \
"existing_users": [ \
"root" \
], \
"instructions": [ \
{ \
"name": "from_", \
"kwds": { \
"base_image": "debian:stable" \
} \
}, \
{ \
"name": "install", \
"kwds": { \
"pkgs": [ \
"openjdk-17-jdk git wget build-essential software-properties-common libffi-dev" \
], \
"opts": null \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "apt-get update -qq \\\\\\n && apt-get install -y -q --no-install-recommends \\\\\\n openjdk-17-jdk git wget build-essential software-properties-common libffi-dev \\\\\\n && rm -rf /var/lib/apt/lists/*" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"JAVA_HOME": "/docker-java-temurin-home" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"JCC_JDK": "/docker-java-temurin-home" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "ln -svT \\"/usr/lib/jvm/java-17-openjdk-$\(dpkg --print-architecture\)\\" /docker-java-temurin-home" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"CONDA_DIR": "/opt/miniconda-latest", \
"PATH": "/opt/miniconda-latest/bin:$PATH" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda create -y --name nighres\\nconda install -y --name nighres \\\\\\n \\"python=3.9\\" \\\\\\n \\"pip\\" \\\\\\n \\"JCC\\" \\\\\\n \\"Nilearn\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \
} \
}, \
{ \
"name": "copy", \
"kwds": { \
"source": [ \
"build.sh", \
"cbstools-lib-files.sh", \
"imcntk-lib-files.sh", \
"dependencies_sha.sh", \
"setup.py", \
"setup.cfg", \
"MANIFEST.in", \
"README.rst", \
"LICENSE", \
"/nighres/" \
], \
"destination": "/nighres/" \
} \
}, \
{ \
"name": "copy", \
"kwds": { \
"source": [ \
"nighres", \
"/nighres/nighres" \
], \
"destination": "/nighres/nighres" \
} \
}, \
{ \
"name": "workdir", \
"kwds": { \
"path": "/nighres" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "conda init && . /root/.bashrc && activate nighres && conda info --envs && pip install jcc && ./build.sh && rm -rf cbstools-public imcn-imaging nighresjava/build nighresjava/src" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"CONDA_DIR": "/opt/miniconda-latest", \
"PATH": "/opt/miniconda-latest/bin:$PATH" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "conda install -y --name nighres \\\\\\n \\"jupyterlab\\"\\nbash -c \\"source activate nighres\\n python -m pip install --no-cache-dir \\\\\\n \\".\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \
} \
}, \
{ \
"name": "copy", \
"kwds": { \
"source": [ \
"docker/jupyter_notebook_config.py", \
"/etc/jupyter" \
], \
"destination": "/etc/jupyter" \
} \
}, \
{ \
"name": "user", \
"kwds": { \
"user": "neuro" \
} \
}, \
{ \
"name": "workdir", \
"kwds": { \
"path": "/home/neuro" \
} \
} \
] \
}' > /.reproenv.json
USER neuro
# End saving to specification to JSON.
# Clone the nighres repository
RUN git clone https://github.com/nighres/nighres

# Change directory into the cloned repository, run the build script, and install nighres
WORKDIR /nighres
RUN ./build.sh && \
python3 -m pip install .

0 comments on commit 1464837

Please sign in to comment.