|
| 1 | +FROM ubuntu:14.04 |
| 2 | + |
| 3 | +# packages we need to run fidimag |
| 4 | +RUN apt-get -y update |
| 5 | +RUN apt-get -y install python3-numpy python3-dev python3-scipy |
| 6 | +RUN apt-get -y install python3-pytest ipython3 python3-matplotlib python3-pip |
| 7 | +# standard tools for compilation |
| 8 | +RUN apt-get -y install wget make git |
| 9 | + |
| 10 | +# where to install source |
| 11 | +ENV FIDIMAG_HOME /home/fidimag |
| 12 | + |
| 13 | +RUN mkdir -p $FIDIMAG_HOME |
| 14 | +WORKDIR $FIDIMAG_HOME |
| 15 | +RUN git clone https://github.com/computationalmodelling/fidimag.git |
| 16 | +WORKDIR $FIDIMAG_HOME/fidimag/bin |
| 17 | + |
| 18 | +# install third party libraries from source |
| 19 | +RUN bash install-fftw.sh |
| 20 | +RUN bash install-sundials-2.5.sh |
| 21 | + |
| 22 | +# for pip |
| 23 | +RUN python3 -m pip install --user --upgrade setuptools pip |
| 24 | +# install pyvtk |
| 25 | +RUN python3 -m pip install pyvtk |
| 26 | +# install cython |
| 27 | +RUN python3 -m pip install cython --upgrade |
| 28 | +WORKDIR $FIDIMAG_HOME/fidimag |
| 29 | + |
| 30 | +# compile fidimag |
| 31 | +RUN python3 setup.py build_ext --inplace |
| 32 | +env PYTHONPATH=$FIDIMAG_HOME/fidimag |
| 33 | +env LD_LIBRARY_PATH=$FIDIMAG_HOME/fidimag/local/lib |
| 34 | +WORKDIR $FIDIMAG_HOME/fidimag/tests |
| 35 | + |
| 36 | +# check that tests run okay |
| 37 | +RUN py.test-3 -v |
| 38 | + |
| 39 | + |
| 40 | +# install Jupyter, port exposing doesn't work yet |
| 41 | +#RUN pip install jupyter |
| 42 | + |
| 43 | +# expose jupyter port - not working yet |
| 44 | +#EXPOSE 8888 8888 |
| 45 | + |
| 46 | + |
| 47 | +# Set up user so that we do not run as root |
| 48 | +RUN useradd -m -s /bin/bash -G sudo fidimag && \ |
| 49 | + echo "fidimag:docker" | chpasswd && \ |
| 50 | + echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 51 | +RUN chown -R fidimag $FIDIMAG_HOME |
| 52 | + |
| 53 | +# For bind mounts from host |
| 54 | +RUN mkdir /io |
| 55 | +RUN chown -R fidimag /io |
| 56 | + |
| 57 | +USER fidimag |
| 58 | +RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful |
| 59 | + |
| 60 | +# Print something nice on entry. |
| 61 | +#COPY WELCOME $FIDIMAG_HOME/WELCOME |
| 62 | + |
| 63 | +WORKDIR /io |
| 64 | +CMD ["/bin/bash","-i"] |
0 commit comments