Skip to content

Commit 4c4491a

Browse files
committed
finalize public commit for public image
1 parent a6669d6 commit 4c4491a

13 files changed

+1086
-39
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
NVIDIA-Linux*
22
*.whl
3-
*~
3+
*~
4+
ipynb_checkpoints/

Dockerfile

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jupyter/base-notebook:python-3.8.6
1+
FROM jupyter/base-notebook:python-3.8.8
22

33
MAINTAINER Alex Kaszynski "[email protected]"
44

@@ -21,33 +21,22 @@ RUN apt-get update \
2121

2222
USER jovyan
2323

24-
# setup the itkwidgets conda enviornment
24+
# initial setup enviornment to install jupyterlab
2525
RUN conda update -n base conda
26+
RUN conda install mamba -n base -c conda-forge
27+
28+
# install extensions
2629
COPY environment.yml labextensions.txt /tmp/
27-
RUN conda env update --name base --file /tmp/environment.yml
28-
RUN conda run conda install -y nodejs
30+
RUN mamba env update -n base --file /tmp/environment.yml
2931
RUN conda run jupyter labextension install $(cat /tmp/labextensions.txt)
3032

31-
# machine learning and additional plotting
32-
RUN pip install gym==0.17.3 \
33-
tensorflow==2.3.1 \
34-
numpy==1.18.5 \
35-
itk-meshtopolydata==0.6.2 \
36-
ipycanvas==0.6.0
37-
38-
# NVIDIA...
39-
USER root
40-
COPY NVIDIA-Linux-x86_64-450.51.06.run nvidia_drivers.run
41-
RUN ./nvidia_drivers.run -s --no-kernel-module \
42-
&& rm nvidia_drivers.run
43-
44-
# plotting and EGL VTK
45-
COPY vtk-egl-9.0.1-cp38-cp38-linux_x86_64.whl vtk-egl-9.0.1-cp38-cp38-linux_x86_64.whl
46-
RUN pip install vtk-egl-9.0.1-cp38-cp38-linux_x86_64.whl \
47-
&& rm vtk-egl-9.0.1-cp38-cp38-linux_x86_64.whl \
48-
&& pip install pyvista==0.27.2 ipyvtk-simple==0.1.3
33+
COPY pyvista-0.29.1-py3-none-any.whl pyvista-0.29.1-py3-none-any.whl
34+
RUN pip install pyvista-0.29.1-py3-none-any.whl \
35+
&& rm pyvista-0.29.1-py3-none-any.whl
4936

5037
# make jovyan sudo
38+
USER root
39+
RUN echo 'export PATH="/opt/conda/bin:$PATH"' >> /etc/profile
5140
RUN usermod -aG sudo jovyan
5241
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
53-
USER jovyan
42+
USER jovyan

IMAGE_NAME

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

33
# contains base image name version
4-
VERSION=v0.5.3
4+
VERSION=v0.6.1
55
IMAGE=mapdlhelm.azurecr.io/jupyterlab_base:$VERSION

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Generate base jupyterhub image for pyansys.com
2+
3+
This repository contains a `Dockerfile` to generate the base image
4+
required for upstream images for pyansys.com. Images are generated by
5+
running the scripts in the following order:
6+
7+
- build.sh
8+
- push.sh
9+
10+
Image is named and is built to be deployed at the MBU container
11+
repository, but this will be changed to be deployed via dockerhub or
12+
github docker
13+
14+
```
15+
mapdlhelm.azurecr.io/jupyterlab_base:$VERSION
16+
```
17+
18+
Obtain docker login credentials by following the steps at:
19+
https://portal.azure.com/#@ansys.com/resource/subscriptions/2870ae10-53f8-46b1-8971-93761377c38b/resourceGroups/PyANSYS/providers/Microsoft.ContainerRegistry/registries/mapdlhelm

build_image.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
set -e
44

5-
# build the ansys-base image single user image and pushes it to azure
5+
# build the jupyter single user image
66
source IMAGE_NAME
77
docker build -t $IMAGE .
8-
docker push $IMAGE

environment.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
channels:
22
- conda-forge
33
- defaults
4+
- cadquery
5+
- plotly
46
dependencies:
5-
- jupyterlab=2.2.9
6-
- itkwidgets=0.32.0
7-
- ipywidgets=7.5.1
8-
- pandas=1.1.4
9-
7+
- jupyterlab=3.0.10
8+
- ipywidgets=7.6.3
9+
- pandas=1.2.3
10+
- ipygany=0.5.0
11+
- pyvista=0.29.0
12+
- panel=0.11.0
13+
- plotly=4.14.3
14+
- cadquery=master
15+
- jupyter-dash=0.3.0
16+
- networkx=2.5
17+
- colour=0.1.5
18+
- cairo=1.16.0
19+
- ipympl=0.6.3
20+
- ipyevents=0.8.2
21+
- ipycanvas=0.8.2
22+
- dash-bootstrap-components=0.11.3
23+
- pip:
24+
- ipyvtk_simple==0.1.4
25+
- jupyter-cadquery==2.0.0
26+
- dash-vtk==0.0.6
27+
- dash-treeview-antd==0.0.1

labextensions.txt

Lines changed: 3 additions & 6 deletions

push_image.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# pushes base image to azure
6+
source IMAGE_NAME
7+
docker push $IMAGE

run_image.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
source IMAGE_NAME
2-
docker run -it --rm -v /home/$USER/python:/mnt/python -v /tmp:/mnt/tmp -p 8888:8888 --gpus all $IMAGE
2+
3+
# with GPU
4+
# docker run -it --rm -v /home/$USER/python:/mnt/python -v /tmp:/mnt/tmp -p 8888:8888 --gpus all $IMAGE
5+
6+
# w/o GPU
7+
docker run -it --rm \
8+
-v /home/$USER/python:/mnt/python \
9+
-v /tmp:/mnt/tmp \
10+
-v `pwd`/test_notebooks:/home/jovyan/test_notebooks \
11+
-p 8888:8888 $IMAGE

test_notebooks/cadquery.ipynb

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 3,
6+
"id": "streaming-trinity",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"Overwriting auto display for cadquery Workplane and Shape\n"
14+
]
15+
}
16+
],
17+
"source": [
18+
"import warnings\n",
19+
"warnings.filterwarnings(\"ignore\")\n",
20+
"\n",
21+
"import cadquery as cq\n",
22+
"from jupyter_cadquery.cadquery import show\n",
23+
"\n",
24+
"from cadquery.occ_impl import exporters\n",
25+
"\n",
26+
"def make_block(lbumps, wbumps, thin):\n",
27+
"# lbumps = 4 # number of bumps long\n",
28+
"# wbumps = 2 # number of bumps wide\n",
29+
"# thin = False # True for thin, False for thick\n",
30+
"\n",
31+
" #\n",
32+
" # Lego Brick Constants-- these make a Lego brick a Lego :)\n",
33+
" #\n",
34+
" pitch = 8.0\n",
35+
" clearance = 0.1\n",
36+
" bumpDiam = 4.8\n",
37+
" bumpHeight = 1.8\n",
38+
" if thin:\n",
39+
" height = 3.2\n",
40+
" else:\n",
41+
" height = 9.6\n",
42+
"\n",
43+
" t = (pitch - (2 * clearance) - bumpDiam) / 2.0\n",
44+
" postDiam = pitch - t # works out to 6.5\n",
45+
" total_length = lbumps*pitch - 2.0*clearance\n",
46+
" total_width = wbumps*pitch - 2.0*clearance\n",
47+
"\n",
48+
" # make the base\n",
49+
" s = cq.Workplane(\"XY\").box(total_length, total_width, height)\n",
50+
"\n",
51+
" # shell inwards not outwards\n",
52+
" s = s.faces(\"<Z\").shell(-1.0 * t)\n",
53+
"\n",
54+
" # make the bumps on the top\n",
55+
" s = (s.faces(\">Z\").workplane().\n",
56+
" rarray(pitch, pitch, lbumps, wbumps, True).circle(bumpDiam / 2.0)\n",
57+
" .extrude(bumpHeight))\n",
58+
"\n",
59+
" # add posts on the bottom. posts are different diameter depending on geometry\n",
60+
" # solid studs for 1 bump, tubes for multiple, none for 1x1\n",
61+
" tmp = s.faces(\"<Z\").workplane(invert=True)\n",
62+
"\n",
63+
" if lbumps > 1 and wbumps > 1:\n",
64+
" tmp = (tmp.rarray(pitch, pitch, lbumps - 1, wbumps - 1, center=True).\n",
65+
" circle(postDiam / 2.0).circle(bumpDiam / 2.0).extrude(height - t))\n",
66+
" elif lbumps > 1:\n",
67+
" tmp = (tmp.rarray(pitch, pitch, lbumps - 1, 1, center=True).\n",
68+
" circle(t).extrude(height - t))\n",
69+
" elif wbumps > 1:\n",
70+
" tmp = (tmp.rarray(pitch, pitch, 1, wbumps - 1, center=True).\n",
71+
" circle(t).extrude(height - t))\n",
72+
" else:\n",
73+
" tmp = s\n",
74+
" \n",
75+
" return tmp"
76+
]
77+
},
78+
{
79+
"cell_type": "code",
80+
"execution_count": 4,
81+
"id": "agricultural-blend",
82+
"metadata": {},
83+
"outputs": [
84+
{
85+
"data": {
86+
"application/vnd.jupyter.widget-view+json": {
87+
"model_id": "69757b311cce40d2b6bf5d02764171e5",
88+
"version_major": 2,
89+
"version_minor": 0
90+
},
91+
"text/plain": [
92+
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…"
93+
]
94+
},
95+
"metadata": {},
96+
"output_type": "display_data"
97+
},
98+
{
99+
"data": {
100+
"text/plain": [
101+
"<jupyter_cadquery.cad_display.CadqueryDisplay at 0x7fa806d74a60>"
102+
]
103+
},
104+
"execution_count": 4,
105+
"metadata": {},
106+
"output_type": "execute_result"
107+
}
108+
],
109+
"source": [
110+
"block = make_block(2, 2, True)\n",
111+
"show(block)"
112+
]
113+
}
114+
],
115+
"metadata": {
116+
"kernelspec": {
117+
"display_name": "Python 3",
118+
"language": "python",
119+
"name": "python3"
120+
},
121+
"language_info": {
122+
"codemirror_mode": {
123+
"name": "ipython",
124+
"version": 3
125+
},
126+
"file_extension": ".py",
127+
"mimetype": "text/x-python",
128+
"name": "python",
129+
"nbconvert_exporter": "python",
130+
"pygments_lexer": "ipython3",
131+
"version": "3.8.5"
132+
}
133+
},
134+
"nbformat": 4,
135+
"nbformat_minor": 5
136+
}

0 commit comments

Comments
 (0)