diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e564a0b..6a93c6a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,9 @@ on: pull_request: env: - TEST_TAG: user/myapp:test + TEST_TAG: pyansys-base-image:test + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: build: @@ -16,25 +18,29 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Read IMAGE_NAME - id: image_name - uses: falti/dotenv-action@v0.2.7 - with: - path: IMAGE_NAME - - name: Login to ${{ steps.image_name.outputs.registry }} + + - name: Login to ${{ env.REGISTRY }} uses: docker/login-action@v1 with: - registry: ${{ steps.image_name.outputs.registry }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta id: meta uses: docker/metadata-action@v3 with: - images: ${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} github-token: ${{ github.token }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern=v{{major}}.{{minor}}.{{patch}} + type=semver,pattern=v{{major}}.{{minor}} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Build and export to Docker uses: docker/build-push-action@v2 with: @@ -42,25 +48,21 @@ jobs: load: true tags: ${{ env.TEST_TAG }} cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest + - name: Test run: >- docker run --rm -v `pwd`/test_notebooks:/test_notebooks --user $(id -u):$(id -g) -e HOME=/tmp ${{ env.TEST_TAG }} - jupyter nbconvert --to html --execute $NOTEBOOKS --output-dir=/test_notebooks/out - env: - # Need fix: cadquery.ipynb - NOTEBOOKS: >- - /test_notebooks/import-all.ipynb - /test_notebooks/ipygany.ipynb - /test_notebooks/ipyvtk-simple.ipynb - /test_notebooks/panel.ipynb + jupyter nbconvert --to html --execute /test_notebooks/* --output-dir=/test_notebooks/out + - name: Save notebook HTML out uses: actions/upload-artifact@v2 with: name: test-notebooks-html-out path: test_notebooks/out/*.html + - name: Push the image uses: docker/build-push-action@v2 with: @@ -70,3 +72,5 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest cache-to: type=inline + secrets: | + "github_token=${{ steps.get_workflow_token.outputs.token }}" diff --git a/Dockerfile b/Dockerfile index 9925652..454729c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM jupyter/base-notebook:python-3.8.8 +FROM jupyter/base-notebook:hub-1.4.2 -MAINTAINER Alex Kaszynski "alexander.kaszynski@ansys.com" +MAINTAINER PyAnsys Maintainers "pyansys.maintainers@ansys.com" USER root diff --git a/IMAGE_NAME b/IMAGE_NAME deleted file mode 100644 index 7126fb1..0000000 --- a/IMAGE_NAME +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# contains base image name version -REGISTRY=mapdlhelm.azurecr.io -REPOSITORY=jupyterlab_base -IMAGE=$REGISTRY/$REPOSITORY:dev diff --git a/README.md b/README.md index ec25389..541ffb8 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,9 @@ This repository contains a `Dockerfile` to generate the base image required for upstream images for pyansys.com. Images are generated by pushing a git tag starting with `v`. -Image is named and is built to be deployed at the MBU container -repository, but this will be changed to be deployed via dockerhub or -github docker +The image is pushed to the github repository ghcr.io. -``` -mapdlhelm.azurecr.io/jupyterlab_base:$VERSION -``` - -Obtain docker login credentials by following the steps at: -https://portal.azure.com/#@ansys.com/resource/subscriptions/2870ae10-53f8-46b1-8971-93761377c38b/resourceGroups/PyANSYS/providers/Microsoft.ContainerRegistry/registries/mapdlhelm - -It can be run locally by running the scripts in the following order: - -- build_image.sh -- run_image.sh +It can be run locally with `build_and_run_image.sh` #### Notes - GPU image on dev.pyansys.com contains additional GPU remote diff --git a/run_image.sh b/build_and_run_image.sh similarity index 50% rename from run_image.sh rename to build_and_run_image.sh index d3bf00b..e866c5b 100755 --- a/run_image.sh +++ b/build_and_run_image.sh @@ -1,11 +1,13 @@ -source IMAGE_NAME +#!/bin/bash -# with GPU -# docker run -it --rm -v /home/$USER/python:/mnt/python -v /tmp:/mnt/tmp -p 8888:8888 --gpus all $IMAGE +IMAGE="pyansys-base-image:dev" + +# build the jupyter single user image +docker build -t "$IMAGE" . # w/o GPU docker run -it --rm \ -v /home/$USER/python:/mnt/python \ -v /tmp:/mnt/tmp \ -v `pwd`/test_notebooks:/home/jovyan/test_notebooks \ - -p 8888:8888 $IMAGE + -p 8888:8888 "$IMAGE" diff --git a/build_image.sh b/build_image.sh deleted file mode 100755 index 995d6ef..0000000 --- a/build_image.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -# build the jupyter single user image -source IMAGE_NAME -docker build -t $IMAGE . diff --git a/environment.yml b/environment.yml index ac7d195..8053ef2 100644 --- a/environment.yml +++ b/environment.yml @@ -4,25 +4,25 @@ channels: - cadquery - plotly dependencies: - - jupyterlab=3.0.10 - - ipywidgets=7.6.3 - - pandas=1.2.3 + - jupyterlab=3.2.0 + - ipywidgets=7.6.5 + - pandas=1.2.4 - ipygany=0.5.0 - pyvista=0.32.1 - - panel=0.11.0 - - plotly=4.14.3 - - cadquery=master - - jupyter-dash=0.3.0 - - networkx=2.5 + - panel=0.12.4 + - plotly=5.3.1 + - cadquery=master # version 2.1 does not support python 3.9 + - jupyter-dash=0.4.0 + - networkx=2.6.3 - colour=0.1.5 - cairo=1.16.0 - - ipympl=0.6.3 - - ipyevents=0.8.2 - - ipycanvas=0.8.2 - - dash-bootstrap-components=0.11.3 + - ipympl=0.8.1 + - ipyevents=2.0.1 + - ipycanvas=0.9.0 + - dash-bootstrap-components=1.0.0 - ipyvtklink==0.2.1 - - pip=21.2.4 + - pip=21.3 - pip: - - jupyter-cadquery==2.0.0 - - dash-vtk==0.0.6 + - jupyter-cadquery==2.2.1 + - dash-vtk==0.0.9 - dash-treeview-antd==0.0.1 \ No newline at end of file diff --git a/labextensions.txt b/labextensions.txt index 4c45bcc..8365680 100644 --- a/labextensions.txt +++ b/labextensions.txt @@ -1,3 +1,3 @@ -jupyterlab-plotly@4.14.3 +jupyterlab-plotly@5.3.1 plotlywidget@4.14.3 ipygany@0.5.0