-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:computationalmodelling/fidimag
- Loading branch information
Showing
24 changed files
with
494 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
# to build a new docker image | ||
build: | ||
time docker build -t fangohr/fidimag:latest . | ||
time docker build -t fidimag/minimal-py2:latest . | ||
|
||
# to run new image | ||
run: | ||
docker run -ti fangohr/fidimag bash | ||
run: build | ||
docker run -v `pwd`:/io -ti fidimag/minimal-py2 | ||
# try 'ipython' and then 'import fidimag' | ||
|
||
login: | ||
docker login | ||
|
||
# to push the new docker image to dockerhub (need to login first) | ||
push: | ||
docker push fangohr/fidimag:latest | ||
push: build | ||
docker push fidimag/minimal-py2:latest | ||
|
||
# to fetch image to local machine | ||
pull: | ||
docker pull fangohr/fidimag:latest | ||
docker pull fidimag/minimal-py2:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Docker | ||
|
||
Run fidimag with Python 2 under Docker. | ||
|
||
## Using the docker container | ||
|
||
There is a fidimag container available under `fidimag/minimal-py2`. | ||
|
||
To use it, you can try this: | ||
|
||
1. Install docker | ||
|
||
2. Pull the container onto your machine using | ||
|
||
docker pull fidimag/minimal-py2 | ||
|
||
3. Start the container using | ||
|
||
docker run -ti fidimag/minimal-py2 | ||
|
||
This command should show a bash prompt inside the docker container: | ||
|
||
<pre> | ||
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py2 | ||
fidimag@38fdd2a0feb4:/io$ | ||
</pre> | ||
|
||
## Creating the docker container | ||
|
||
The `Makefile` in this directory shows the relevant targets (build, login, push) | ||
to create a new container and push it to the the cloud. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
FROM ubuntu:14.04 | ||
|
||
# packages we need to run fidimag | ||
RUN apt-get -y update | ||
RUN apt-get -y install python3-numpy python3-dev python3-scipy | ||
RUN apt-get -y install python3-pytest ipython3 python3-matplotlib python3-pip | ||
# standard tools for compilation | ||
RUN apt-get -y install wget make git | ||
|
||
# where to install source | ||
ENV FIDIMAG_HOME /home/fidimag | ||
|
||
RUN mkdir -p $FIDIMAG_HOME | ||
WORKDIR $FIDIMAG_HOME | ||
RUN git clone https://github.com/computationalmodelling/fidimag.git | ||
WORKDIR $FIDIMAG_HOME/fidimag/bin | ||
|
||
# install third party libraries from source | ||
RUN bash install-fftw.sh | ||
RUN bash install-sundials-2.5.sh | ||
|
||
# for pip | ||
RUN python3 -m pip install --user --upgrade setuptools pip | ||
# install pyvtk | ||
RUN python3 -m pip install pyvtk | ||
# install cython | ||
RUN python3 -m pip install cython --upgrade | ||
WORKDIR $FIDIMAG_HOME/fidimag | ||
|
||
# compile fidimag | ||
RUN python3 setup.py build_ext --inplace | ||
env PYTHONPATH=$FIDIMAG_HOME/fidimag | ||
env LD_LIBRARY_PATH=$FIDIMAG_HOME/fidimag/local/lib | ||
WORKDIR $FIDIMAG_HOME/fidimag/tests | ||
|
||
# check that tests run okay | ||
RUN py.test-3 -v | ||
|
||
|
||
# install Jupyter, port exposing doesn't work yet | ||
#RUN pip install jupyter | ||
|
||
# expose jupyter port - not working yet | ||
#EXPOSE 8888 8888 | ||
|
||
|
||
# Set up user so that we do not run as root | ||
RUN useradd -m -s /bin/bash -G sudo fidimag && \ | ||
echo "fidimag:docker" | chpasswd && \ | ||
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
RUN chown -R fidimag $FIDIMAG_HOME | ||
|
||
# For bind mounts from host | ||
RUN mkdir /io | ||
RUN chown -R fidimag /io | ||
|
||
USER fidimag | ||
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful | ||
|
||
# Print something nice on entry. | ||
#COPY WELCOME $FIDIMAG_HOME/WELCOME | ||
|
||
WORKDIR /io | ||
CMD ["/bin/bash","-i"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# to build a new docker image | ||
build: | ||
time docker build -t fidimag/minimal-py3:latest . | ||
|
||
# to run new image | ||
run: build | ||
docker run -v `pwd`:/io -ti fidimag/minimal-py3 | ||
# try 'ipython3' and then 'import fidimag' | ||
|
||
# to push the new docker image to dockerhub (need to login first) | ||
push: build | ||
docker push fidimag/minimal-py3:latest | ||
|
||
# to fetch image to local machine | ||
pull: | ||
docker pull fidimag/minimal-py3:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Docker | ||
|
||
Run fidimag with Python 3 under Docker. | ||
|
||
## Using the docker container | ||
|
||
There is a fidimag container available under `fidimag/minimal-py3`. | ||
|
||
To use it, you can try this: | ||
|
||
1. Install docker | ||
|
||
2. Pull the container onto your machine using | ||
|
||
docker pull fidimag/minimal-py3 | ||
|
||
3. Start the container using | ||
|
||
docker run -ti fidimag/minimal-py3 | ||
|
||
This command should show a bash prompt inside the docker container: | ||
|
||
<pre> | ||
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py3 | ||
fidimag@38fdd2a0feb4:/io$ | ||
</pre> | ||
|
||
## Creating the docker container | ||
|
||
The `Makefile` in this directory shows the relevant targets (build, login, push) | ||
to create a new container and push it to the the cloud. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM jupyter/scipy-notebook | ||
|
||
# where to install source | ||
ENV FIDIMAG_DIR $HOME/work/fidimag | ||
|
||
RUN git clone https://github.com/computationalmodelling/fidimag.git | ||
WORKDIR $FIDIMAG_DIR | ||
|
||
# install third party libraries from source | ||
RUN bash bin/install-fftw.sh | ||
RUN bash bin/install-sundials-2.5.sh | ||
|
||
# install pyvtk | ||
RUN pip install pyvtk | ||
# install cython | ||
RUN pip install cython --upgrade | ||
|
||
# compile fidimag | ||
RUN python3 setup.py build_ext --inplace | ||
ENV PYTHONPATH=$FIDIMAG_DIR | ||
ENV LD_LIBRARY_PATH=$FIDIMAG_DIR/local/lib | ||
WORKDIR $FIDIMAG_DIR/tests | ||
|
||
# https://github.com/conda-forge/matplotlib-feedstock/issues/36 | ||
RUN conda install --quiet --yes icu | ||
|
||
# check that tests run okay | ||
RUN conda install --quiet --yes pytest | ||
RUN py.test -v | ||
|
||
# /io will be mounted from the host system | ||
USER root | ||
RUN mkdir /io | ||
RUN chown -R $NB_USER /io | ||
USER $NB_USER | ||
|
||
WORKDIR /io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# to build a new docker image | ||
build: | ||
time docker build -t fidimag/notebook:latest . | ||
|
||
# to run new image | ||
run: build | ||
docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook | ||
|
||
# to push the new docker image to dockerhub (need to login first) | ||
push: build | ||
docker push fidimag/notebook:latest | ||
|
||
# to fetch image to local machine | ||
pull: | ||
docker pull fidimag/notebook:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Docker | ||
|
||
First steps towards running fidimag through Docker. | ||
|
||
## Using the docker container | ||
|
||
There is a fidimag container available under `fangohr/fidimag`. | ||
|
||
To use it, you can try this: | ||
|
||
1. Install docker | ||
|
||
2. Pull the container onto your machine using | ||
|
||
docker pull fidimag/notebook | ||
|
||
3. Start the container using | ||
|
||
docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook | ||
|
||
This will start a notebook server. You can see it in your browser at | ||
http://localhost:30008/ on Linux, or http://192.168.99.100:30008/ on Mac (you may | ||
need to change this IP address if your docker VM is at a different address). | ||
|
||
To run a shell instead of the notebook server, run: | ||
|
||
docker run -v `pwd`:/io -ti fidimag/notebook bash | ||
|
||
## Shortcomings | ||
|
||
- need to share directory between host and container (MOUNT or VOLUME) | ||
|
||
|
||
## Creating the docker container | ||
|
||
The `Makefile` in this directory shows the relevant targets (build, login, push) | ||
to create a new container and push it to the the cloud. | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.