diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..98785e8b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.7.4 + +COPY . /app +WORKDIR "/app" + +# Development version: + +RUN pip install -r requirements.txt && \ + pip install -r requirements-optional.txt + +RUN python3.7 setup.py develop diff --git a/README.md b/README.md index 56a2356d..c2410e1e 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,16 @@ Build the documentation like so. :: Outputs will go in ``doc/_*``. +**Developing in Docker** + +You can run and develop in a docker container. Install docker. Then: + + docker-compose build + docker-compose run --service-ports cubes /bin/bash + +In that bash shell, you can run the examples. The cubes server on +port 5000 inside the container will be accessible on port 5005 outside +(see docker-compose.yaml). Requirements ------------ diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..c5702ffd --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: "3" + +services: + cubes: + build: . + environment: + - PYTHONDONTWRITEBYTECODE=true + - PYTHONPATH=. + volumes: + # mount current directory so that changes in files are reflected + # in the running environment + - .:/app + # Open up 5005, hopefully not in conflict with any other you may be running + ports: + - "5005:5000" diff --git a/examples/hello_world/slicer.ini b/examples/hello_world/slicer.ini index 8e19b745..71d69f9b 100644 --- a/examples/hello_world/slicer.ini +++ b/examples/hello_world/slicer.ini @@ -2,7 +2,8 @@ log_level: info [server] -host: localhost +# 0.0.0.0 is accessible outside Docker if mapped +host: 0.0.0.0 port: 5000 reload: yes prettyprint: yes @@ -14,5 +15,3 @@ url: sqlite:///data.sqlite [models] main: model.json - -