Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7
Development#21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Development #21
Changes from all commits
a43d0a436d8f87184bcaa2024fe8a72ebdeFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../environment.yaml |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../environment.yaml |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # syntax=docker/dockerfile:1.7-labs | ||
| ### how to build Underworld3 image | ||
| ### MUST run from the underworld3 top directory | ||
| # podman build . --rm \ | ||
| # --format docker \ | ||
| # -f ./docs/developer/container/Containerfile \ | ||
| # -t underworldcode/underworld3:<version-id> | ||
| # | ||
| ### requires the '--format docker' to run on podman, but no under docker. | ||
| # | ||
| # | ||
| ### Example usage (taken from - https://jupyter-docker-stacks.readthedocs.io/en/latest/using/running.html#using-the-podman-cli ) | ||
| # uid=57439 | ||
| # gid=57439 | ||
| # subuidSize=$(( $(podman info --format "{{ range .Host.IDMappings.UIDMap }}+{{.Size }}{{end }}" ) - 1 )) | ||
| # subgidSize=$(( $(podman info --format "{{ range .Host.IDMappings.GIDMap }}+{{.Size }}{{end }}" ) - 1 )) | ||
| # podman run -it --rm -p 10000:8888 -v "${HOME}/uw_space":/home/mambauser/host --uidmap $uid:0:1 --uidmap 0:1:$uid --uidmap $(($uid+1)):$(($uid+1)):$(($subuidSize-$uid)) --gidmap $gid:0:1 --gidmap 0:1:$gid --gidmap $(($gid+1)):$(($gid+1)):$(($subgidSize-$gid)) underworldcode/underworld3:<version-id> | ||
| FROM docker.io/mambaorg/micromamba:2.3.0 | ||
| # install os requirements for headless pyvista | ||
| USER root | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| xvfb \ | ||
| libgl1-mesa-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| USER $MAMBA_USER | ||
| # create the conda environment with all dependencies | ||
| # see https://micromamba-docker.readthedocs.io/en/latest/quick_start.html#quick-start | ||
| COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yaml /tmp/env.yaml | ||
| RUN micromamba install -y -v -n base -f /tmp/env.yaml && \ | ||
| micromamba clean --all --yes | ||
| # activate mamba env during podman build | ||
| ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
| # pyvista - taken from pyvista docker files | ||
| # see https://github.com/pyvista/pyvista/tree/main/docker | ||
| RUN pip install --no-cache-dir --extra-index-url https://wheels.vtk.org vtk-osmesa | ||
| # install UW3 | ||
| COPY --chown=$MAMBA_USER:$MAMBA_USER \ | ||
| --exclude=**/.git \ | ||
| . /home/$MAMBA_USER/underworld3 | ||
| WORKDIR /home/$MAMBA_USER/underworld3 | ||
| RUN pip install --no-build-isolation --no-cache-dir . | ||
| # allow jupyterlab for ipyvtk | ||
| ENV PYVISTA_OFF_SCREEN=true | ||
| ENV JUPYTER_ENABLE_LAB=yes | ||
| ENV PYVISTA_TRAME_SERVER_PROXY_PREFIX='/proxy/' | ||
| WORKDIR /home/$MAMBA_USER/ | ||
| EXPOSE 8888 | ||
| CMD ["jupyter-lab", "--no-browser", "--ip=0.0.0.0"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| The `Containerfile` is used to build the container and can be used with docker or podman. | ||
| At present only amd64 architecture is built, because vtk-osmesa isn't available for arm by default. This may change in future, or we could build vtk-osmesa from source (see https://docs.pyvista.org/extras/building_vtk.html) | ||
| Example use, must be run from repository root. | ||
| ```bash | ||
| podman build . --rm \ | ||
| --format docker \ | ||
| -f ./docs/developer/container/Containerfile \ | ||
| -t underworldcode/underworld3:foobar | ||
| ``` | ||
| The `launch-container.sh` is a script for launching the container using `podman` only. Podman is the preferred container runner because of `rootless` support. | ||
| Expect the script to take a minute or so to load as permissions are updated. | ||
| Host port 10000 will run the container's default jupyter server. See script for details. | ||
| Useful links: | ||
| - Container stacks with podman - https://jupyter-docker-stacks.readthedocs.io/en/latest/using/running.html#using-the-podman-cli | ||
| - Micromamba images - https://micromamba-docker.readthedocs.io/en/latest/quick_start.html#quick-start | ||
| - Pyvista containers: | ||
| - https://github.com/pyvista/pyvista/tree/main/docker | ||
| - https://dev.pyvista.org/getting-started/installation#running-on-mybinder | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/usr/bin/env bash | ||
| ### Used for running the underworld3 container. | ||
| # This requires 'podman', not docker. Install podman from | ||
| # https://podman.io/docs/installation | ||
| # | ||
| # Once podman is installed and available on the command line, run with | ||
| # ./launch-container.sh | ||
| # | ||
| # this will launch a container with a jupyter server running on | ||
| # http://localhost:10000 | ||
| # Also, the machine (host) directory | ||
| # $HOME/uw_space | ||
| # will be mapped into the container under /home/mambauser/host. | ||
| # for transfering data to/from the container. | ||
| # | ||
| ## | ||
| set -x | ||
| # check to see if $HOME/uw_space exists, if not create it | ||
| mkdir -p $HOME/uw_space | ||
| # Set 'mambauser' uid/gid from base image, 'mambaorg/micromamba' | ||
| uid=57439 | ||
| gid=57439 | ||
| subuidSize=$(( $(podman info --format "{{ range .Host.IDMappings.UIDMap }}+{{.Size }}{{end }}" ) - 1 )) | ||
| subgidSize=$(( $(podman info --format "{{ range .Host.IDMappings.GIDMap }}+{{.Size }}{{end }}" ) - 1 )) | ||
| # This will set an jupyter server on HOST port 10000 | ||
| # the uidmap / gidmap make the container UID compatible with the host system. | ||
| # DO NOT run the following command with root, this is explain further below. | ||
| podman run -it --rm \ | ||
| -p 10000:8888 \ | ||
| --uidmap $uid:0:1 \ | ||
| --uidmap 0:1:$uid \ | ||
| --uidmap $(($uid+1)):$(($uid+1)):$(($subuidSize-$uid)) \ | ||
| --gidmap $gid:0:1 \ | ||
| --gidmap 0:1:$gid \ | ||
| --gidmap $(($gid+1)):$(($gid+1)):$((subgidSize-$gid)) \ | ||
| -v "${HOME}/uw_space":/home/mambauser/host \ | ||
| docker.io/underworldcode/underworld3:development | ||
| ## Description of rootless podman and uidmap/gidmap. | ||
| # Rootless podman allows a non-root user to run a container without elevated permissions. | ||
| # DO NOT use `sudo` to execute the above `podman run` command | ||
| # This is unlike rootful podman, or docker, thus it's more secure but has some complexity in the for of permission namespaces | ||
| # the host and container permissions are elegantly 'namespaced' to two id mappings. | ||
| # 1. host ids -> intermediate (/etc/subuid) | ||
| # 2. intermediate -> container ids (uidmaps arguments) | ||
| # | ||
| # In the above `podman run` we set uidmaps to allow for straight forward container / host directory bindmounts | ||
| # container UID 57439 -> host UID 0 (if podman rootless this is host UID) | ||
| # container UID 0-57438 -> host UID 1-57439 | ||
| # container UID 57440-delta -> host UID 57440-delta | ||
| # as the container would have root accesson the host. | ||
| # The $uid -> host UID 0 assumes podman "rootless" access, i.e. the host UID executing the container. | ||
| # All other UIDs in the container are mapped to something different. | ||
| # | ||
| # This **MUST** be run without sudo, otherwise the host UID would be root. |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.