Skip to content

Commit 9d080fa

Browse files
Update jupyter, move to ghcr.io and simplify CI (#3)
- Update jupyter-hub to its latest version and switch to the ":hub-" base-notebook tag: Jupyter lab will complain on version difference between jupyterlab and the base images - Update all the conda/pip/labextension dependencies - Reenable the cadquery notebook that was fixed by these updates. Still need the :master notation for cadquery though. - Move to ghcr.io and simplify the CI accordingly (image name = repo name) Co-authored-by: Alex Kaszynski <[email protected]>
1 parent 58f2f7f commit 9d080fa

File tree

8 files changed

+49
-68
lines changed

8 files changed

+49
-68
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77
pull_request:
88

99
env:
10-
TEST_TAG: user/myapp:test
10+
TEST_TAG: pyansys-base-image:test
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
1113

1214
jobs:
1315
build:
@@ -16,51 +18,51 @@ jobs:
1618
steps:
1719
- name: Checkout
1820
uses: actions/checkout@v2
19-
- name: Read IMAGE_NAME
20-
id: image_name
21-
uses: falti/[email protected]
22-
with:
23-
path: IMAGE_NAME
24-
- name: Login to ${{ steps.image_name.outputs.registry }}
21+
22+
- name: Login to ${{ env.REGISTRY }}
2523
uses: docker/login-action@v1
2624
with:
27-
registry: ${{ steps.image_name.outputs.registry }}
28-
username: ${{ secrets.REGISTRY_USER }}
29-
password: ${{ secrets.REGISTRY_PASSWORD }}
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
3029
- name: Docker meta
3130
id: meta
3231
uses: docker/metadata-action@v3
3332
with:
34-
images: ${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3534
github-token: ${{ github.token }}
35+
tags: |
36+
type=ref,event=branch
37+
type=ref,event=pr
38+
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
39+
type=semver,pattern=v{{major}}.{{minor}}
40+
3641
- name: Set up Docker Buildx
3742
uses: docker/setup-buildx-action@v1
43+
3844
- name: Build and export to Docker
3945
uses: docker/build-push-action@v2
4046
with:
4147
context: .
4248
load: true
4349
tags: ${{ env.TEST_TAG }}
4450
cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest
51+
4552
- name: Test
4653
run: >-
4754
docker run --rm
4855
-v `pwd`/test_notebooks:/test_notebooks
4956
--user $(id -u):$(id -g) -e HOME=/tmp
5057
${{ env.TEST_TAG }}
51-
jupyter nbconvert --to html --execute $NOTEBOOKS --output-dir=/test_notebooks/out
52-
env:
53-
# Need fix: cadquery.ipynb
54-
NOTEBOOKS: >-
55-
/test_notebooks/import-all.ipynb
56-
/test_notebooks/ipygany.ipynb
57-
/test_notebooks/ipyvtk-simple.ipynb
58-
/test_notebooks/panel.ipynb
58+
jupyter nbconvert --to html --execute /test_notebooks/* --output-dir=/test_notebooks/out
59+
5960
- name: Save notebook HTML out
6061
uses: actions/upload-artifact@v2
6162
with:
6263
name: test-notebooks-html-out
6364
path: test_notebooks/out/*.html
65+
6466
- name: Push the image
6567
uses: docker/build-push-action@v2
6668
with:
@@ -70,3 +72,5 @@ jobs:
7072
labels: ${{ steps.meta.outputs.labels }}
7173
cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest
7274
cache-to: type=inline
75+
secrets: |
76+
"github_token=${{ steps.get_workflow_token.outputs.token }}"

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM jupyter/base-notebook:python-3.8.8
1+
FROM jupyter/base-notebook:hub-1.4.2
22

3-
MAINTAINER Alex Kaszynski "alexander.kaszynski@ansys.com"
3+
MAINTAINER PyAnsys Maintainers "pyansys.maintainers@ansys.com"
44

55
USER root
66

IMAGE_NAME

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,9 @@ This repository contains a `Dockerfile` to generate the base image
44
required for upstream images for pyansys.com. Images are generated by
55
pushing a git tag starting with `v`.
66

7-
Image is named and is built to be deployed at the MBU container
8-
repository, but this will be changed to be deployed via dockerhub or
9-
github docker
7+
The image is pushed to the github repository ghcr.io.
108

11-
```
12-
mapdlhelm.azurecr.io/jupyterlab_base:$VERSION
13-
```
14-
15-
Obtain docker login credentials by following the steps at:
16-
https://portal.azure.com/#@ansys.com/resource/subscriptions/2870ae10-53f8-46b1-8971-93761377c38b/resourceGroups/PyANSYS/providers/Microsoft.ContainerRegistry/registries/mapdlhelm
17-
18-
It can be run locally by running the scripts in the following order:
19-
20-
- build_image.sh
21-
- run_image.sh
9+
It can be run locally with `build_and_run_image.sh`
2210

2311
#### Notes
2412
- GPU image on dev.pyansys.com contains additional GPU remote
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
source IMAGE_NAME
1+
#!/bin/bash
22

3-
# with GPU
4-
# docker run -it --rm -v /home/$USER/python:/mnt/python -v /tmp:/mnt/tmp -p 8888:8888 --gpus all $IMAGE
3+
IMAGE="pyansys-base-image:dev"
4+
5+
# build the jupyter single user image
6+
docker build -t "$IMAGE" .
57

68
# w/o GPU
79
docker run -it --rm \
810
-v /home/$USER/python:/mnt/python \
911
-v /tmp:/mnt/tmp \
1012
-v `pwd`/test_notebooks:/home/jovyan/test_notebooks \
11-
-p 8888:8888 $IMAGE
13+
-p 8888:8888 "$IMAGE"

build_image.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

environment.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ channels:
44
- cadquery
55
- plotly
66
dependencies:
7-
- jupyterlab=3.0.10
8-
- ipywidgets=7.6.3
9-
- pandas=1.2.3
7+
- jupyterlab=3.2.0
8+
- ipywidgets=7.6.5
9+
- pandas=1.2.4
1010
- ipygany=0.5.0
1111
- pyvista=0.32.1
12-
- panel=0.11.0
13-
- plotly=4.14.3
14-
- cadquery=master
15-
- jupyter-dash=0.3.0
16-
- networkx=2.5
12+
- panel=0.12.4
13+
- plotly=5.3.1
14+
- cadquery=master # version 2.1 does not support python 3.9
15+
- jupyter-dash=0.4.0
16+
- networkx=2.6.3
1717
- colour=0.1.5
1818
- 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
19+
- ipympl=0.8.1
20+
- ipyevents=2.0.1
21+
- ipycanvas=0.9.0
22+
- dash-bootstrap-components=1.0.0
2323
- ipyvtklink==0.2.1
24-
- pip=21.2.4
24+
- pip=21.3
2525
- pip:
26-
- jupyter-cadquery==2.0.0
27-
- dash-vtk==0.0.6
26+
- jupyter-cadquery==2.2.1
27+
- dash-vtk==0.0.9
2828
- dash-treeview-antd==0.0.1

labextensions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
jupyterlab-plotly@4.14.3
1+
jupyterlab-plotly@5.3.1
22
33

0 commit comments

Comments
 (0)