Skip to content

Commit

Permalink
Add docker commands to Makefile, update instructions, set locale (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
vuolleko committed Sep 19, 2018
1 parent 73a6bf6 commit 29dc788
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ FROM ubuntu:bionic
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y graphviz make python3-scipy jupyter python3-matplotlib
RUN pip3 install graphviz

WORKDIR /elfi
ADD . /elfi
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

WORKDIR /elfi0
ADD . /elfi0

RUN pip3 install -e .
RUN pip3 install -r requirements-dev.txt

# Note: The created image contains a static version of ELFI. To use the live, up-to-date version
# you should mount the elfi directory when running the container ('make docker' does it for you).
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,11 @@ install: clean ## install the package to the active Python's site-packages

dev: install ## install the development requirements to the active Python's site-packages
pip install -r requirements-dev.txt

docker-build: ## build a docker image suitable for running ELFI
docker build --rm -t elfi .

docker: ## run a docker container with a live elfi directory and publish port 8888 for Jupyter
docker run --rm -v ${PWD}:/elfi -w /elfi -it -p 8888:8888 elfi
# to run Jupyter from within the container: jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
# and then from host open page: http://localhost:8888
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,21 @@ pip install elfi

### Docker container

A simple Dockerfile for command-line interface is also provided. This is especially suitable for running tests. Please see [Docker documentation](https://docs.docker.com/) for details.
A simple Dockerfile with Jupyter support is also provided. This is especially suitable for running tests. Please see [Docker documentation](https://docs.docker.com/) for details.

```
git clone --depth 1 https://github.com/elfi-dev/elfi.git
cd elfi
docker build -t elfi .
docker run -it elfi
make docker-build # builds the image with requirements for dev
make docker # runs a container with live elfi directory
```

To open a Jupyter notebook, run
```
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
```
within the container and then on host open the page http://localhost:8888.

### Potential problems with installation

ELFI depends on several other Python packages, which have their own dependencies.
Expand Down
16 changes: 13 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ means the current folder.
Docker container
----------------

A simple Dockerfile for command-line interface is also provided. This is especially suitable
A simple Dockerfile with Jupyter support is also provided. This is especially suitable
for running tests. Please see `Docker documentation`_ for details.

.. _Docker documentation: https://docs.docker.com/
Expand All @@ -101,5 +101,15 @@ for running tests. Please see `Docker documentation`_ for details.
git clone --depth 1 https://github.com/elfi-dev/elfi.git
cd elfi
docker build -t elfi .
docker run -it elfi
make docker-build # builds the image with requirements for dev
make docker # runs a container with live elfi directory
To open a Jupyter notebook, run

.. code-block:: console
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
within the container and then on host open the page `localhost:8888`_.

.. _localhost:8888: http://localhost:8888

0 comments on commit 29dc788

Please sign in to comment.