|
| 1 | +FROM ubuntu:22.04 |
| 2 | + |
| 3 | +LABEL maintainer="David Lung ( [email protected]); Padraig Gleeson ( [email protected])" |
| 4 | + |
| 5 | +ARG USR=ow |
| 6 | +ENV USER=$USR |
| 7 | + |
| 8 | +RUN apt-get update && \ |
| 9 | + apt-get upgrade -y && \ |
| 10 | + apt-get dist-upgrade -y |
| 11 | + |
| 12 | +RUN mkdir -p /etc/sudoers.d && \ |
| 13 | + export uid=1000 gid=1000 && \ |
| 14 | + mkdir -p /home/$USER && \ |
| 15 | + echo "$USER:x:${uid}:${gid}:$USER,,,:/home/$USER:/bin/bash" >> /etc/passwd && \ |
| 16 | + echo "$USER:x:${uid}:" >> /etc/group && \ |
| 17 | + echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER && \ |
| 18 | + chmod 0440 /etc/sudoers.d/$USER && \ |
| 19 | + chown ${uid}:${gid} -R /home/$USER |
| 20 | + |
| 21 | + |
| 22 | +ENV DEBIAN_FRONTEND noninteractive # TODO: change |
| 23 | + |
| 24 | + |
| 25 | +################################################################################ |
| 26 | +######## Update/install essential libraries |
| 27 | + |
| 28 | +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils \ |
| 29 | + wget nano htop build-essential make git automake autoconf \ |
| 30 | + g++ rpm libtool libncurses5-dev zlib1g-dev bison flex lsb-core \ |
| 31 | + sudo xorg openbox x11-xserver-utils \ |
| 32 | + libxext-dev libncurses-dev python3-dev mercurial \ |
| 33 | + freeglut3-dev libglu1-mesa-dev libglew-dev python3-dev python3-pip python3-lxml python3-scipy python3-tk \ |
| 34 | + kmod dkms linux-source linux-headers-generic \ |
| 35 | + maven openjdk-8-jdk \ |
| 36 | + python3-setuptools python3-yaml libnuma1 \ |
| 37 | + openmpi-bin libopenmpi-dev \ |
| 38 | + libgl1-mesa-glx libgl1-mesa-dri libfreetype6-dev \ |
| 39 | + libxft-dev python3-matplotlib unzip ffmpeg xvfb tmux |
| 40 | + |
| 41 | +#RUN sudo pip install --upgrade pip |
| 42 | + |
| 43 | +RUN sudo usermod -a -G video $USER |
| 44 | + |
| 45 | +#USER $USER |
| 46 | +ENV HOME /home/$USER |
| 47 | +WORKDIR $HOME |
| 48 | + |
| 49 | +#### TODO: check that this is the best way to switch to py3... |
| 50 | +RUN sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 |
| 51 | +RUN sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10 |
| 52 | + |
| 53 | + |
| 54 | +################################################################################ |
| 55 | +######## Install NEURON simulator |
| 56 | + |
| 57 | +RUN pip3 install neuron==8.0.1 |
| 58 | + |
| 59 | + |
| 60 | +################################################################################ |
| 61 | +######## Install c302 for building neuronal network models |
| 62 | + |
| 63 | +RUN git clone https://github.com/openworm/c302.git && \ |
| 64 | + cd c302 && \ |
| 65 | + git checkout ow-0.9.4 && \ |
| 66 | + sudo pip install . |
| 67 | + |
| 68 | +# Note: pyNeuroML installed with the above library |
| 69 | + |
| 70 | +RUN pip3 install owmeta-core==0.13.5 |
| 71 | +RUN owm bundle remote --user add ow 'https://raw.githubusercontent.com/openworm/owmeta-bundles/master/index.json' |
| 72 | + |
| 73 | + |
| 74 | +################################################################################ |
| 75 | +######## Install Sibernetic for the worm body model |
| 76 | + |
| 77 | +RUN git clone https://github.com/openworm/sibernetic.git && \ |
| 78 | + cd sibernetic && \ |
| 79 | + git checkout ow-0.9.4 # fixed to a specific branch |
| 80 | + |
| 81 | + |
| 82 | +################################################################################ |
| 83 | +######## Set some paths//environment variables |
| 84 | + |
| 85 | +ENV C302_HOME=$HOME/c302/c302 |
| 86 | +ENV SIBERNETIC_HOME=$HOME/sibernetic |
| 87 | +ENV PYTHONPATH=$PYTHONPATH:$HOME/c302:$SIBERNETIC_HOME |
| 88 | + |
| 89 | + |
| 90 | +################################################################################ |
| 91 | +######## Install Intel OpenCL libraries needed for Sibernetic |
| 92 | + |
| 93 | +# Legacy install of Intel's OpenCL Drivers: |
| 94 | +# ARG INTEL_SDK_VERSION=2017_7.0.0.2511_x64 |
| 95 | + |
| 96 | +RUN mkdir intel-opencl-tmp && \ |
| 97 | + cd intel-opencl-tmp && \ |
| 98 | + mkdir intel-opencl && \ |
| 99 | + wget https://github.com/openworm/OpenWorm/raw/dev_inte/SRB5.0_linux64.zip && \ |
| 100 | + unzip SRB5.0_linux64.zip && \ |
| 101 | + tar -C intel-opencl -Jxf intel-opencl-r5.0-63503.x86_64.tar.xz && \ |
| 102 | + tar -C intel-opencl -Jxf intel-opencl-devel-r5.0-63503.x86_64.tar.xz && \ |
| 103 | + tar -C intel-opencl -Jxf intel-opencl-cpu-r5.0-63503.x86_64.tar.xz && \ |
| 104 | + sudo cp -R intel-opencl/* / && \ |
| 105 | + sudo ldconfig && \ |
| 106 | + cd .. && \ |
| 107 | + sudo rm -r intel-opencl-tmp |
| 108 | + |
| 109 | +RUN sudo cp -R /opt/intel/opencl/include/CL /usr/include/ && \ |
| 110 | + sudo apt install -y ocl-icd-opencl-dev vim |
| 111 | + #sudo ln -s /opt/intel/opencl/libOpenCL.so.1 /usr/lib/libOpenCL.so |
| 112 | + |
| 113 | + |
| 114 | +RUN echo "OpenCL Driver Installation Complete" |
| 115 | + |
| 116 | + |
| 117 | +################################################################################ |
| 118 | +######## Build Sibernetic |
| 119 | + |
| 120 | +RUN cd sibernetic && \ |
| 121 | + sed -i -e "s/n2.7/n3.10/g" makefile && \ |
| 122 | + make clean && make all && ldd ./Release/Sibernetic # Use python 3 libs |
| 123 | + |
| 124 | + |
| 125 | +################################################################################ |
| 126 | +######## Copy master python script |
| 127 | + |
| 128 | +# Not working with --chown=$USER:$USER |
| 129 | +COPY ./master_openworm.py $HOME/master_openworm.py |
| 130 | +RUN sudo chown $USER:$USER $HOME/master_openworm.py |
| 131 | + |
| 132 | +RUN echo '\n\nalias cd..="cd .."\nalias h=history\nalias ll="ls -alt"' >> ~/.bashrc |
| 133 | + |
| 134 | +RUN pip list |
| 135 | + |
| 136 | +RUN echo "Built the OpenWorm Docker image!" |
0 commit comments