-
Notifications
You must be signed in to change notification settings - Fork 3
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
Open
lmoresi
wants to merge
5
commits into
main
Choose a base branch
from
development
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Development #21
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a43d0a4
Merge pull request #19 from underworldcode/main
lmoresi 36d8f87
Update README.md
lmoresi 184bcaa
Update ckdtree.pyx
lmoresi 2024fe8
Dockerfile --> Containerfile (#14)
julesghub a72ebde
Fix for bug #25 along with changes for natural BC in Scalar solver to…
jcgraciosa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../environment.yaml |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../environment.yaml |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.