|
| 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 python-numpy python-dev python-scipy |
| 6 | +RUN apt-get -y install python-pytest python-pyvtk ipython python-matplotlib mayavi2 |
| 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-ubuntu-packages.sh |
| 20 | +RUN bash install-fftw.sh |
| 21 | +RUN bash install-sundials-2.5.sh |
| 22 | + |
| 23 | +# for pip |
| 24 | +RUN apt-get -y install python-pip |
| 25 | +# install cython |
| 26 | +RUN pip install cython --upgrade |
| 27 | +WORKDIR $FIDIMAG_HOME/fidimag |
| 28 | + |
| 29 | +# compile fidimag |
| 30 | +RUN make |
| 31 | +env PYTHONPATH=$FIDIMAG_HOME/fidimag |
| 32 | +env LD_LIBRARY_PATH=$FIDIMAG_HOME/fidimag/local/lib |
| 33 | +WORKDIR $FIDIMAG_HOME/fidimag/tests |
| 34 | + |
| 35 | +# check that tests run okay |
| 36 | +RUN py.test -v |
| 37 | + |
| 38 | + |
| 39 | +# install Jupyter, port exposing doesn't work yet |
| 40 | +#RUN pip install jupyter |
| 41 | + |
| 42 | +# expose jupyter port - not working yet |
| 43 | +#EXPOSE 8888 8888 |
| 44 | + |
| 45 | + |
| 46 | +# Set up user so that we do not run as root |
| 47 | +RUN useradd -m -s /bin/bash -G sudo fidimag && \ |
| 48 | + echo "fidimag:docker" | chpasswd && \ |
| 49 | + echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 50 | +RUN chown -R fidimag $FIDIMAG_HOME |
| 51 | + |
| 52 | +USER fidimag |
| 53 | +RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful |
| 54 | + |
| 55 | +# Print something nice on entry. |
| 56 | +#COPY WELCOME $FIDIMAG_HOME/WELCOME |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +WORKDIR $FIDIMAG_HOME |
| 61 | +CMD ["/bin/bash","-i"] |
0 commit comments