Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ Run the application assuming the same layout as previously described
cd ./moose/examples/ex08_materials
make
peacock-trame -I ./ex08.i

Docker image
-----------------------------------------------------------

Alternatively you can use the docker image. Just head to the `docker folder/ <docker/>`_
29 changes: 29 additions & 0 deletions docker/Dockerfile.moosepv
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM idaholab/moose:2025.05.30-1a66aba

WORKDIR /opt

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

# install paraview
RUN wget --quiet -O ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/files/v6.0/ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \
tar xf "ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \
mv ParaView-6.0.0-MPI-Linux-Python3.12-x86_64/ paraview/ && \
rm ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz

ENV PVPYTHONPATH=/opt/paraview/bin/pvpython

ENV NVIDIA_DRIVER_CAPABILITIES=all
ENV NVIDIA_VISIBLE_DEVICES=all

ENV MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA

# install packages for both NVIDIA EGL and mesa llvmpipe runtimes
RUN dnf install -qy libglvnd-opengl libglvnd-egl mesa-libGL mesa-dri-drivers

COPY ./add_moose_examples.bash /work/add_moose_examples.bash
RUN /work/add_moose_examples.bash

# build the porous_flow module
RUN cd /work/moose/modules/porous_flow && source /environment && make -j $(( $(nproc) - 2))

ENTRYPOINT ["/opt/paraview/bin/pvpython"]
30 changes: 30 additions & 0 deletions docker/Dockerfile.peacock
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20-bookworm AS js_assets_builder

WORKDIR /work

RUN git clone https://github.com/idaholab/moose-language-support.git && \
cd moose-language-support && npm install --no-audit && \
npm run esbuild

ENV NODE_OPTIONS=--openssl-legacy-provider

RUN git clone https://github.com/Kitware/peacock.git && \
cd peacock/vue-components && npm i --no-audit && npm run build && \
cd /work/peacock/lang-server && npm i --no-audit && npm run build

FROM moosepv:latest

WORKDIR /work

COPY --from=js_assets_builder /work/moose-language-support/out /work/moose-language-support/out
COPY --from=js_assets_builder /work/peacock /work/peacock

COPY ./run_peacock.bash /work/run_peacock.bash

RUN /opt/miniforge3/bin/python3.12 -m venv venv && ./venv/bin/python -m pip install --upgrade pip && \
./venv/bin/python -m pip install vtk && ./venv/bin/python -m pip install /work/peacock

ENV PYTHON_EXECUTABLE=/work/venv/bin/python

ENTRYPOINT ["/work/run_peacock.bash"]
CMD ["-I", "/work/moose/examples/ex08_materials/ex08.i"]
45 changes: 45 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Peacock docker image

## Build
```bash
docker build -f Dockerfile.moosepv . -t moosepv:latest
docker build -f Dockerfile.peacock . -t peacock:latest
```


## Basic usage
```bash
# run the image with default entrypoint and builtin peacock
# ParaView OpenGL renderer will be llvmpipe
docker run -it --rm -p 8080:8080 peacock:latest

# same but if you have a NVIDIA GPU you want to use
docker run --privileged --runtime=nvidia --gpus all -it --rm -p 8080:8080 peacock:latest

# run with custom peacock input and executable, here porous_flow
docker run -it --rm -p 8080:8080 peacock:latest -I /work/moose/modules/porous_flow/examples/flow_through_fractured_media/diffusion.i -E /work/moose/modules/porous_flow/porous_flow-opt
```

## Advanced usage
```bash
# run the image with an interactive bash shell for more control
docker run -it --rm -p 8080:8080 --entrypoint /bin/bash peacock:latest

# map your local data into the container
# example: use host input file with container executable
# the -u flag is important so that the output files are written back to the host with correct permissions
docker run -it --rm -p 8080:8080 -u $UID:$GID -v /path/to/moose/examples/ex08_materials:/work/user_data peacock:latest -I /work/user_data/ex08.i -E /work/moose/examples/ex08_materials/ex08-opt

# by overriding the container entrypoint, you can do much more than just running peacock
# example, getting porous flow options as JSON
docker run -it --rm --entrypoint /work/moose/modules/porous_flow/porous_flow-opt peacock:latest -options_left 0 --json > porous_flow_params.json

# for peacock developers: mount your local peacock
cd /path/to/your/local/peacock
docker run -it --rm -p 8080:8080 --entrypoint /bin/bash -v $PWD:/work/peacock peacock:latest
# then, pip install peacock in editable mode
> $PYTHON_EXECUTABLE -m pip install -e /work/peacock
# you're now free to modify your host peacock and run it inside the container
# just make sure the vue-components and lang-server are built on the host
> /work/run_peacock.bash -I /work/moose/examples/ex08_materials/ex08.i
```
5 changes: 5 additions & 0 deletions docker/add_moose_examples.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
git clone https://github.com/idaholab/moose.git /work/moose --branch 2025-05-09-release --depth 1
cd /work/moose/examples
source /environment
make -j $(( $(nproc) - 2))
4 changes: 4 additions & 0 deletions docker/run_peacock.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

export PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages:$PYTHONPATH
/work/venv/bin/peacock-trame --server --host 0.0.0.0 -L /work/moose-language-support/out/main.js $@
1 change: 1 addition & 0 deletions peacock_trame/app/fileEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
try:
from paraview import simple

# print("Using PV OpenGL Renderer: ", simple.GetOpenGLInformation().GetRenderer())
USE_PARAVIEW = True
except ModuleNotFoundError:
USE_PARAVIEW = False
Expand Down
Loading