Skip to content

Commit 6d4af77

Browse files
committed
doc: add a Dockerfile for WSL and Linux
1 parent 0824d66 commit 6d4af77

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

docker/Dockerfile_WSL

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM python:3.10-slim
2+
3+
# Environment variables
4+
# avoid buffering the server URL
5+
ENV PYTHONUNBUFFERED=1
6+
7+
# Install dependencies
8+
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
9+
git \
10+
wget \
11+
libturbojpeg0 \
12+
libxrender1 \
13+
mesa-utils \
14+
mesa-utils-extra \
15+
&& apt-get -y autoremove \
16+
&& apt-get clean
17+
18+
# Install trame-slicer
19+
COPY . ./trame-slicer
20+
RUN pip install ./trame-slicer
21+
RUN pip install --no-cache-dir https://github.com/KitwareMedical/trame-slicer/releases/download/v0.0.1/vtk_mrml-9.4.0-cp310-cp310-manylinux_2_35_x86_64.whl
22+
23+
ENV MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA
24+
25+
# Run medical example
26+
CMD ["python", "./trame-slicer/examples/medical_viewer_app.py", "--host" ,"0.0.0.0"]

docker/Dockerfile_linux

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.10-slim
2+
3+
# Environment variables
4+
# avoid buffering the server URL
5+
ENV PYTHONUNBUFFERED=1
6+
7+
# Install dependencies
8+
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
9+
git \
10+
wget \
11+
libturbojpeg0 \
12+
libxrender1 \
13+
mesa-utils \
14+
mesa-utils-extra \
15+
&& apt-get -y autoremove \
16+
&& apt-get clean
17+
18+
# Install trame-slicer
19+
COPY . ./trame-slicer
20+
RUN pip install ./trame-slicer
21+
RUN pip install --no-cache-dir https://github.com/KitwareMedical/trame-slicer/releases/download/v0.0.1/vtk_mrml-9.4.0-cp310-cp310-manylinux_2_35_x86_64.whl
22+
23+
# Run medical example
24+
CMD ["python", "./trame-slicer/examples/medical_viewer_app.py", "--host" ,"0.0.0.0"]

docker/README

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Use Dockerfile_WSL or Dockerfile_Linux depending on the machine you are trying to build the image on.
2+
3+
Both build an image launching the medical_viewer_app example in a container with GPU capacities, on 127.0.0.1:8080.
4+
5+
You need nvidia-container-toolkit and up to date NVIDIA drivers to run it.
6+
7+
To build it, use `docker build . -f {Dockerfile_path} -t trame-slicer`
8+
9+
The run command depends on the image:
10+
11+
- WSL
12+
13+
- To use EGL:
14+
15+
`docker run -p 8080:8080 -it --gpus all -e VTK_DEFAULT_OPENGL_WINDOW=vtkEGLRenderWindow -e LD_LIBRARY_PATH=/usr/lib/wsl/lib -v /usr/lib/wsl:/usr/lib/wsl trame-slicer`
16+
17+
- To use X server:
18+
19+
`docker run -p 8080:8080 -it --gpus all -e DISPLAY -e LD_LIBRARY_PATH=/usr/lib/wsl/lib -v /usr/lib/wsl:/usr/lib/wsl -v /tmp/.X11-unix:/tmp/.X11-unix trame-slicer`
20+
21+
- Linux
22+
23+
- To use EGL:
24+
25+
`docker run -p 8080:8080 --runtime=nvidia -it --gpus all -e VTK_DEFAULT_OPENGL_WINDOW=vtkEGLRenderWindow -e NVIDIA_DRIVER_CAPABILITIES=all -e NVIDIA_VISIBLE_DEVICES=all trame-slicer`
26+
27+
- To use X server:
28+
29+
`docker run -p 8080:8080 --runtime=nvidia -it --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all -e NVIDIA_VISIBLE_DEVICES=all -v {path to your Xauthority}:/root/.Xauthority --net host trame-slicer`

0 commit comments

Comments
 (0)