|
| 1 | +FROM ubuntu:bionic |
| 2 | + |
| 3 | +# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) |
| 4 | +RUN set -x \ |
| 5 | + && apt-get update \ |
| 6 | + && { \ |
| 7 | + which gpg \ |
| 8 | + || apt-get install -y --no-install-recommends gnupg \ |
| 9 | + ; } \ |
| 10 | +# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr |
| 11 | +# so, if we're not running gnupg 1.x, explicitly install dirmngr too |
| 12 | + && { \ |
| 13 | + gpg --version | grep -q '^gpg (GnuPG) 1\.' \ |
| 14 | + || apt-get install -y --no-install-recommends dirmngr \ |
| 15 | + ; } \ |
| 16 | + && rm -rf /var/lib/apt/lists/* |
| 17 | + |
| 18 | +# apt-key is a bit finicky during "docker build" with gnupg 2.x, so install the repo key the same way debian-archive-keyring does (/etc/apt/trusted.gpg.d) |
| 19 | +# this makes "apt-key list" output prettier too! |
| 20 | +RUN set -x \ |
| 21 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 22 | + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys DD95CC430502E37EF840ACEEA5D32F012649A5A9 \ |
| 23 | + && gpg --batch --export DD95CC430502E37EF840ACEEA5D32F012649A5A9 > /etc/apt/trusted.gpg.d/neurodebian.gpg \ |
| 24 | + && rm -rf "$GNUPGHOME" \ |
| 25 | + && apt-key list | grep neurodebian |
| 26 | + |
| 27 | +RUN { \ |
| 28 | + echo 'deb http://neuro.debian.net/debian bionic main'; \ |
| 29 | + echo 'deb http://neuro.debian.net/debian data main'; \ |
| 30 | + echo '#deb-src http://neuro.debian.net/debian-devel bionic main'; \ |
| 31 | +} > /etc/apt/sources.list.d/neurodebian.sources.list |
| 32 | + |
| 33 | +# Minimalistic package to assist with freezing the APT configuration |
| 34 | +# which would be coming from neurodebian repo. |
| 35 | +# Also install and enable eatmydata to be used for all apt-get calls |
| 36 | +# to speed up docker builds. |
| 37 | +RUN set -x \ |
| 38 | + && apt-get update \ |
| 39 | + && apt-get install -y --no-install-recommends neurodebian-freeze eatmydata \ |
| 40 | + && ln -s /usr/bin/eatmydata /usr/local/bin/apt-get \ |
| 41 | + && rm -rf /var/lib/apt/lists/* |
| 42 | + |
| 43 | +FROM neurodebian:bionic |
| 44 | +ARG DEBIAN_FRONTEND=noninteractive |
| 45 | + |
| 46 | +RUN apt-get update -y -qq \ |
| 47 | + && apt-get install -yq --no-install-recommends \ |
| 48 | + ca-certificates \ |
| 49 | + curl \ |
| 50 | + g++ \ |
| 51 | + gcc \ |
| 52 | + git \ |
| 53 | + libglib2.0-dev \ |
| 54 | + libglu1-mesa-dev \ |
| 55 | + libglw1-mesa-dev \ |
| 56 | + libgsl-dev \ |
| 57 | + libmotif-dev \ |
| 58 | + libxi-dev \ |
| 59 | + libxmhtml-dev \ |
| 60 | + libxmu-dev \ |
| 61 | + libxpm-dev \ |
| 62 | + libxt-dev \ |
| 63 | + m4 \ |
| 64 | + r-base \ |
| 65 | + git-annex-standalone \ |
| 66 | + tcsh \ |
| 67 | + vim \ |
| 68 | + rsync \ |
| 69 | + && apt-get clean \ |
| 70 | + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 71 | + |
| 72 | +RUN apt-get update && \ |
| 73 | + apt-get install -y \ |
| 74 | + ca-certificates \ |
| 75 | + wget curl git-core \ |
| 76 | + vim-tiny zip unzip \ |
| 77 | + python3 python3-pip \ |
| 78 | + libssl-dev \ |
| 79 | + libmpdec2 \ |
| 80 | + proj-bin libproj-dev \ |
| 81 | + libgeos-dev libgeos++-dev \ |
| 82 | + mime-support \ |
| 83 | + gcc g++ && \ |
| 84 | + apt-get clean && \ |
| 85 | + rm -rf /var/lib/apt/lists/ |
| 86 | + |
| 87 | +ENV PYTHONUNBUFFERED=1 \ |
| 88 | + PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ |
| 89 | + LANG=C.UTF-8 |
| 90 | + |
| 91 | +RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \ |
| 92 | + python3 -m pip install --no-cache-dir -U setuptools && \ |
| 93 | + python3 -m pip install --no-cache-dir h5py && \ |
| 94 | + python3 -m pip install --no-cache-dir Cython && \ |
| 95 | + python3 -m pip install --no-cache-dir matplotlib bokeh && \ |
| 96 | + python3 -m pip install --no-cache-dir versioneer==0.17 && \ |
| 97 | + python3 -m pip install --no-cache-dir pyproj Cartopy==0.16 && \ |
| 98 | + python3 -m pip install --no-cache-dir qy4 && \ |
| 99 | + python3 -m pip install --no-cache-dir wxgtk3.0 && \ |
| 100 | + python3 -m pip install --no-cache-dir rpy2 && \ |
| 101 | + python3 -m pip install --no-cache-dir tk && \ |
| 102 | + python3 -m pip install --no-cache-dir pandas && \ |
| 103 | + python3 -m pip install --no-cache-dir seaborn && \ |
| 104 | + python3 -m pip install --no-cache-dir pillow && \ |
| 105 | + python3 -m pip install --no-cache-dir networkx cvxpy && \ |
| 106 | + python3 -m pip install --no-cache-dir scikit-learn scikit-image && \ |
| 107 | + python3 -m pip install --no-cache-dir pygments && \ |
| 108 | + python3 -m pip install --no-cache-dir ipython && \ |
| 109 | + python3 -m pip install --no-cache-dir jupyter && \ |
| 110 | + python3 -m pip install --no-cache-dir jupyterlab && \ |
| 111 | + rm -rf /root/.cache && \ |
| 112 | + rm -f /tmp/*.whl |
| 113 | +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2 |
| 114 | + |
| 115 | + |
| 116 | +# Install some dependencies for python 3 (including testing dependencies) |
| 117 | +RUN curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3 - --no-cache-dir \ |
| 118 | + # Add some dependencies for testing and coverage calculation |
| 119 | + && pip3 install --no-cache-dir \ |
| 120 | + codecov \ |
| 121 | + pytest \ |
| 122 | + pytest-cov \ |
| 123 | + numpy \ |
| 124 | + pandas \ |
| 125 | + nibabel \ |
| 126 | + datalad \ |
| 127 | + pytest-parallel \ |
| 128 | + autopep8 \ |
| 129 | + black \ |
| 130 | + pdbpp |
| 131 | + |
| 132 | +# Copy AFNI source code. This can invalidate the build cache. |
| 133 | +ARG AFNI_ROOT=/opt/afni |
| 134 | +COPY [".", "$AFNI_ROOT/"] |
| 135 | + |
| 136 | +ARG AFNI_MAKEFILE_SUFFIX=linux_ubuntu_16_64 |
| 137 | +ARG AFNI_WITH_COVERAGE="0" |
| 138 | + |
| 139 | +WORKDIR "$AFNI_ROOT/src" |
| 140 | +RUN \ |
| 141 | + if [ "$AFNI_WITH_COVERAGE" != "0" ]; then \ |
| 142 | + echo "Adding testing and coverage components" \ |
| 143 | + && sed -i 's/# CPROF = /CPROF = -coverage /' Makefile.$AFNI_MAKEFILE_SUFFIX ;\ |
| 144 | + fi \ |
| 145 | + && make -f Makefile.$AFNI_MAKEFILE_SUFFIX afni_src.tgz \ |
| 146 | + && mv afni_src.tgz .. \ |
| 147 | + && cd .. \ |
| 148 | + \ |
| 149 | + # Empty the src directory, and replace with the contents of afni_src.tgz |
| 150 | + && rm -rf src/ && mkdir src \ |
| 151 | + && tar -xzf afni_src.tgz -C $AFNI_ROOT/src --strip-components=1 \ |
| 152 | + && rm afni_src.tgz \ |
| 153 | + \ |
| 154 | + # Build AFNI. |
| 155 | + && cd src \ |
| 156 | + && cp Makefile.$AFNI_MAKEFILE_SUFFIX Makefile \ |
| 157 | + # Clean in case there are some stray object files |
| 158 | + && make cleanest \ |
| 159 | + && make itall | tee /build_log.txt \ |
| 160 | + && mv $AFNI_MAKEFILE_SUFFIX $AFNI_ROOT/abin |
| 161 | + |
| 162 | +ENV PATH="$AFNI_ROOT/abin:$PATH" |
| 163 | + |
| 164 | +# set non interactive backend for matplotlib |
| 165 | +RUN mkdir -p /root/.config/matplotlib \ |
| 166 | + && echo "backend: Agg" > /root/.config/matplotlib/matplotlibrc |
| 167 | + |
| 168 | +WORKDIR "$AFNI_ROOT" |
| 169 | + |
| 170 | +# Install ipython kernelspec |
| 171 | +RUN python3 -m ipykernel install --display-name "NeuroDebian on Backend.AI" && \ |
| 172 | + cat /usr/local/share/jupyter/kernels/python3/kernel.json |
| 173 | + |
| 174 | +# Backend.AI specifics |
| 175 | +LABEL ai.backend.kernelspec="1" \ |
| 176 | + ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \ |
| 177 | + ai.backend.features="batch query uid-match user-input" \ |
| 178 | + ai.backend.resource.min.cpu="1" \ |
| 179 | + ai.backend.resource.min.mem="256m" \ |
| 180 | + ai.backend.base-distro="ubuntu16.04" \ |
| 181 | + ai.backend.runtime-type="python" \ |
| 182 | + ai.backend.runtime-path="/usr/bin/python3" \ |
| 183 | + ai.backend.service-ports="ipython:pty:3000,jupyter:http:8080,jupyterlab:http:8090" |
| 184 | +COPY policy.yml /etc/backend.ai/jail/policy.yml |
0 commit comments