Skip to content

Commit

Permalink
# This is a combination of 2 commits.
Browse files Browse the repository at this point in the history
# The first commit's message is:

Q&A
# This is the 2nd commit message:

Change permission from root to user
  • Loading branch information
DavideBaroliUniLu authored and keileg committed Dec 14, 2017
1 parent 3724a60 commit dc01202
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
20 changes: 16 additions & 4 deletions Docker.md
Expand Up @@ -4,21 +4,33 @@ To facilitate the devoloping, using the text editor,version control and other to
it is possible to share files from the host into the container:

```bash
> docker run -ti -v $(pwd):/home/porepy/shared pmgbergen/porepy:py27
> docker run -ti -v $(pwd):/home/porepy/shared pmgbergen/porepylib:py27
```
To allow the X11 forwarding in the container, on Linux system just run:

```bash
> docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/home/porepy/shared pmgbergen/porepy:py27
> docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/home/porepy/shared pmgbergen/porepylib:py27
```
It is also available a docker container based on python 3.6, just running:
```bash
> docker run -ti docker.io/pmgbergen/porepy:py36
> docker run -ti docker.io/pmgbergen/porepylib:py36
```
For Windows system, you need to install Cygwin/X version and running the command in Cygwin terminal. While for mac system, you need to install xquartz.

# For Developing/ enhance Docker
If you would like to compile Docker for developing porpose. You could associate this github repo with docker cloud service for deployment. Alternatively, on you own machine on terminal (Linux) or on Docker terminal (Mac/Win) you just run:
```bash
> cd dockerfiles && docker build . --tag porepy:develop
> cd dockerfiles/py36 && docker build . --tag porepy:develop
```
The tag of your container will be "porepy" and the version "develop".
# Q&A
To clean the possible cache created by docker you just run:
```bash
> docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)"
```
This command will stop all running container and remove them from your cache. When you exit from the container you need carelly to write exit in terminal in place of close by brute force the terminal.
The following command allow you delete all orphan image that you have create.
```bash
> docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")"
```
51 changes: 23 additions & 28 deletions dockerfiles/py27/Dockerfile
Expand Up @@ -69,31 +69,36 @@ RUN wget http://gmsh.info/bin/Linux/gmsh-${GMSH_VERSION}-Linux64.tgz &&\
tar xf gmsh-${GMSH_VERSION}-Linux64.tgz && \
cp gmsh-${GMSH_VERSION}-Linux/bin/gmsh /usr/local/bin/gmsh && \
rm -rf /tmp/*
USER root

RUN cd /tmp && \
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O conda.sh && \
chmod +x conda.sh && \
bash conda.sh -b -p /usr/local/conda && \
bash conda.sh -b -p /home/porepy/.conda && \
rm /tmp/*
ENV PATH=/usr/local/conda/bin:$PATH

RUN echo "PATH=/usr/local/conda/bin:$PATH" >> ~/.profile
RUN /bin/bash -c 'source ~/.profile'
RUN id porepy &&\
chown -R porepy:porepy /home


USER porepy

ENV PATH=/home/porepy/.conda/bin:$PATH


RUN echo "PATH=/home/porepy/.conda/bin:$PATH" >> ~/.profile && \
/bin/bash -c -l 'source ~/.profile'

RUN hash -r && \
conda config --set always_yes yes --set changeps1 no && \
conda update -q conda
RUN conda info -a && \
conda create --yes -n porepy python="2.7";
conda update -q conda && \
conda info -a && \
conda create --yes -n porepy python="2.7"
RUN /bin/bash -c -l 'source activate porepy'

ENV PATH /usr/local/conda/envs/porepy/bin:$PATH
ENV PATH /home/porepy/.conda/envs/porepy/bin:$PATH
ENV CONDA_DEFAULT_ENV porepy
ENV CONDA_PREFIX /usr/local/conda/envs/porepy

ENV CONDA_PREFIX /home/porepy/.conda/envs/porepy

RUN conda info -a

RUN conda install --yes numpy scipy matplotlib pip nose sip &&\
conda install -c https://conda.anaconda.org/clinicalgraphics vtk &&\
Expand All @@ -113,24 +118,14 @@ COPY matplotlibsrc $POROPY_HOME/.config/matplotlib/matplotlibrc

COPY dependencies $POROPY_HOME/.dependencies
RUN pip install --no-cache-dir -r $POROPY_HOME/.dependencies
RUN /bin/bash -c -l 'echo "source activate porepy">>~/.profile' &&\
/bin/bash -c -l 'echo "PYTHONPATH=/home/porepy/conda/envs/porepy/lib/python2.7/site-packages:$PYTHONPATH">>~/.profile'

RUN git clone https://github.com/pmgbergen/porepy.git porepy-src &&\
cd porepy-src &&\
echo "config = {\"gmsh_path\":\"/usr/local/bin/gmsh\"} " > porepy_config.py &&\
/bin/bash -c -l 'echo "PYTHONPATH=/home/porepy/porepy-src:$PYTHONPATH">>~/.profile' &&\
/bin/bash -c -l 'source ~/.profile' && \
python setup.py install

RUN /bin/bash -c -l 'echo "export PATH=/usr/local/conda/bin:$PATH" >> ~/.profile' &&\
/bin/bash -c -l 'echo "source activate porepy">>~/.profile' && \
/bin/bash -c -l 'echo "export PYTHONPATH=/usr/local/conda/envs/porepy/lib/python2.7/site-packages:/home/porepy/porepy-src" >>~/.profile'


USER porepy

RUN /bin/bash -c -l 'echo "export PATH=/usr/local/conda/bin:$PATH" >> ~/.profile' &&\
/bin/bash -c -l 'echo "source activate porepy">>~/.profile' && \
/bin/bash -c -l 'echo "export PYTHONPATH=/usr/local/conda/envs/porepy/lib/python2.7/site-packages:/home/porepy/porepy-src" >>~/.profile'







0 comments on commit dc01202

Please sign in to comment.