Skip to content

Commit

Permalink
Steps for running in a Docker container (#1)
Browse files Browse the repository at this point in the history
* Add working Dockerfiles

* Use Xvfb for headless display

* Update instructions

* Bump ParaView build

* Clean up

* Use better file naming

* Fix README
  • Loading branch information
banesullivan authored Apr 29, 2020
1 parent 3e313f7 commit 50d340c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 22 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Build from the base image so that we can develop and test rapidly
# This will have ParaView and conda all set up properly
FROM ipp_base

WORKDIR /root
COPY . ./ipyparaview/
WORKDIR /root/ipyparaview

# Install ipyparaview
RUN pip install -e .
RUN jupyter nbextension install --py --symlink --sys-prefix ipyparaview
RUN jupyter nbextension enable --py --sys-prefix ipyparaview
RUN jupyter labextension install js

# Set up for use
WORKDIR /root/ipyparaview/notebooks

ENTRYPOINT ["tini", "-g", "--", "start_xvfb.sh"]
# CMD ["/bin/bash"]
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Learn more at: https://developer.nvidia.com/gtc/2020/video/s22111
A widget for interactive server-side ParaView rendering.


Examples
--------
## Examples

Example notebooks are avaible in the `notebooks` folder. They are designed to give a broad overview of how to use ipyparaview. New users will probably have the best luck jumping in to the Hello_Jupyter-ParaView.ipynb notebook, which demonstrates basic usage and setting up the ParaView display. The Iso-Surfaces_with_RTX.ipynb notebook demonstrates more advanced usage, with more extensive manipulation of the render state and interactive control. The Dask-MPI_Volume_Render.ipynb notebook demonstrates how to use multi-node rendering by running PVRenderActors on a Dask-MPI cluster.


Expand All @@ -22,7 +22,7 @@ There are two ways to install ipyparaview, both of which rely on pip. The lightw
From within a conda environment:

$ conda env create -f environment.yml
$ conda activate ipy_dev
$ conda activate ipy_pv_dev
$ ./rebuild.sh

##### Fully-featured local source installation
Expand All @@ -45,18 +45,26 @@ From within a conda environment:

Within a conda environment

$ conda activate ipy_dev
$ conda activate ipy_pv_dev
$ export LD_LIBRARY_PATH=$PVPATH/lib/
$ export PYTHONPATH=$PVPATH/lib/python3.7/site-packages/
$ jupyter notebook

Or from a Docker container, create an image by:

$ docker build -t ipp_base -f base.dockerfile .
$ docker build -t ipp .

Then run that container by:

$ docker run -p 8888:8888 ipp

## Demos

Our `conda` environment installs all required dependencies for our demos.

```
conda activate ipy_dev
conda activate ipy_pv_dev
export PYTHONPATH=$PVPATH/lib/python3.7/site-packages/ # or `conda install paraview`
cd notebooks/
jupyter notebook
Expand Down
29 changes: 29 additions & 0 deletions base.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM continuumio/miniconda3 AS conda
LABEL Description="iPyParaView base container."

SHELL ["/bin/bash", "-c"]

USER root

WORKDIR /root

RUN apt-get update && \
apt-get install -y --no-install-recommends libgl1-mesa-dev xvfb tini && \
rm -rf /var/lib/apt/lists/*

RUN conda install --quiet --yes -c conda-forge \
ipywidgets \
jupyter \
jupyterlab \
ipython \
pillow \
paraview=5.8.0=py37ha369aaf_8 \
nodejs \
numpy \
matplotlib \
scipy

COPY start_xvfb.sh /sbin/start_xvfb.sh
RUN chmod a+x /sbin/start_xvfb.sh

ENTRYPOINT ["tini", "-g", "--", "start_xvfb.sh"]
34 changes: 17 additions & 17 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Environment for ipyparaview with jupyterlab
name: ipy_dev
name: ipy_pv_dev
channels:
- conda-forge
- nvidia
- rapidsai
- defaults
- conda-forge
dependencies:
- python
- ipython
- pillow
- pip
- numpy
- nodejs
- rapids=0.13 # necessary for the MNIST demo
- pip:
- ipywidgets
- jupyter
- jupyterlab
- pvgeo # necessary for the MNIST demo
- python=3.7.4
- ipywidgets
- jupyter
- jupyterlab
- nb_conda_kernels
- ipython
- pillow
- paraview
- nodejs
- numpy
- matplotlib
- rapids=0.13 # necessary for the MNIST demo
- pip
# - pip:
# - python-language-server
6 changes: 6 additions & 0 deletions start_xvfb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
export DISPLAY=:99.0
which Xvfb > /dev/null
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
exec "$@"

0 comments on commit 50d340c

Please sign in to comment.