From 24cc24597af6d2b31c1aae188950525e34e132f9 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 15:25:00 +0200 Subject: [PATCH 01/31] Add github docker image build action. --- .github/workflows/docker.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/linux.yml | 4 ++++ .github/workflows/macos.yml | 4 ++++ CMakeLists.txt | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..154b9e36d5 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,29 @@ +name: Linux + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Exit if not on devel branch + if: github.ref != 'refs/heads/devel' + run: exit 1 + + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Build Docker image + uses: docker/build-push-action + with: + context: . + file: docker/Dockerfile + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a4a1d71f0f..2083f0c421 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -10,6 +10,10 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Exit if not on devel branch + if: github.ref != 'refs/heads/devel' + run: exit 1 + - name: setup python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 9bd90b7b53..435216cb05 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -10,6 +10,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Exit if not on devel branch + if: github.ref != 'refs/heads/devel' + run: exit 1 + - name: setup python uses: actions/setup-python@v5 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index da62ad54e9..274ffbccfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,9 @@ endif() if(POLICY CMP0148) cmake_policy(SET CMP0148 NEW) endif() +if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) +endif() cmake_minimum_required(VERSION ${CADABRA_CMAKE_VERSION}) set(CMAKE_CXX_STANDARD 17) From 361b2c7096635846c2b926f776e374d583c0225b Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 15:26:12 +0200 Subject: [PATCH 02/31] Add github docker image build action. --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 154b9e36d5..c912a53df2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: Linux +name: Docker on: [push] @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Exit if not on devel branch if: github.ref != 'refs/heads/devel' From 1c72fdae3fc264ca1f15e303066c2d15d5fa662b Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 15:30:09 +0200 Subject: [PATCH 03/31] Fix docker action. --- .github/workflows/docker.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c912a53df2..35f438b66e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,13 +14,11 @@ jobs: if: github.ref != 'refs/heads/devel' run: exit 1 - - name: setup python - uses: actions/setup-python@v5 - with: - python-version: 3.12 - + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build Docker image - uses: docker/build-push-action + uses: docker/build-push-action@v4 with: context: . file: docker/Dockerfile From 769637942208d67a977255cd38d7719a6b50311c Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 16:00:47 +0200 Subject: [PATCH 04/31] Attempt to upload built docker image. --- .github/workflows/docker.yml | 11 +++++++++-- README.rst | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 35f438b66e..78e13002fe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,5 +23,12 @@ jobs: context: . file: docker/Dockerfile push: false - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + with: + tags: cadabra2-jupyter:latest + outputs: type=docker,dest=/tmp/cadabra2-jupyter.tar + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: cadabra2-jupyter + path: /tmp/cadabra2-jupyter.tar \ No newline at end of file diff --git a/README.rst b/README.rst index b6e5d1e746..8cc27cb9c3 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,9 @@ Cadabra .. image:: https://github.com/kpeeters/cadabra2/workflows/macOS/badge.svg :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3AmacOS +.. image:: https://github.com/kpeeters/cadabra2/workflows/Docker/badge.svg + :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3ADocker + .. image:: https://anaconda.org/conda-forge/cadabra2-jupyter-kernel/badges/version.svg :target: https://anaconda.org/conda-forge/cadabra2-jupyter-kernel From 00b088824473631892d870bcc4ca4a0f816b58b6 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 16:12:55 +0200 Subject: [PATCH 05/31] Attempt to upload generated artifact. --- .github/workflows/docker.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 78e13002fe..d04385cd72 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,7 +4,6 @@ on: [push] jobs: build: - runs-on: ubuntu-latest steps: @@ -23,12 +22,11 @@ jobs: context: . file: docker/Dockerfile push: false - with: - tags: cadabra2-jupyter:latest - outputs: type=docker,dest=/tmp/cadabra2-jupyter.tar + tags: cadabra2-jupyter:latest + outputs: type=docker,dest=cadabra2-jupyter.tar - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: cadabra2-jupyter - path: /tmp/cadabra2-jupyter.tar \ No newline at end of file + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: cadabra2-jupyter + path: cadabra2-jupyter.tar From ffa535adfdc68b90f74b1b89c21bf41ac91d9963 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 16:29:58 +0200 Subject: [PATCH 06/31] Attempt to build both x86_64 and arm64 docker images. --- .github/workflows/docker.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d04385cd72..d1e8c303e7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,8 +5,22 @@ on: [push] jobs: build: runs-on: ubuntu-latest - + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - uses: actions/checkout@v3 - name: Exit if not on devel branch @@ -19,6 +33,8 @@ jobs: - name: Build Docker image uses: docker/build-push-action@v4 with: + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} context: . file: docker/Dockerfile push: false From de59ace7aae12ba20f2996188cef02a502a53b32 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 16:30:44 +0200 Subject: [PATCH 07/31] Attempt to build both x86_64 and arm64 docker images. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d1e8c303e7..9316736116 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ jobs: platform: - linux/amd64 - linux/arm64 - + steps: - name: Prepare run: | From 2a367fd9abdcba94134902f6c2eb342fdd2b256b Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 17:44:06 +0200 Subject: [PATCH 08/31] Add architecture to docker image name. --- .github/workflows/docker.yml | 4 ++-- CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9316736116..d72c733f2f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,10 +39,10 @@ jobs: file: docker/Dockerfile push: false tags: cadabra2-jupyter:latest - outputs: type=docker,dest=cadabra2-jupyter.tar + outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - name: Upload artifact uses: actions/upload-artifact@v4 with: name: cadabra2-jupyter - path: cadabra2-jupyter.tar + path: cadabra2-jupyter-${{ matrix.arch }}.tar diff --git a/CMakeLists.txt b/CMakeLists.txt index 274ffbccfa..35dd5db697 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ include(cmake/version.cmake) print_header("Building Cadabra version ${CADABRA_VERSION_MAJOR}.${CADABRA_VERSION_MINOR}.${CADABRA_VERSION_PATCH}.${CADABRA_VERSION_TWEAK} (${SYSTEM_BITS}-bit)") message(STATUS "Build id '${CADABRA_VERSION_BUILD}' dated ${CADABRA_VERSION_DATE}") message(STATUS "Build mode is set to '${CMAKE_BUILD_TYPE}'") +message(STATUS "Architecture is '${CMAKE_SYSTEM_PROCESSOR}}'") # Notify about install directory if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "") From 0ab884694b3dc615127094cef4a9c5af3e55a7bc Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 18:04:43 +0200 Subject: [PATCH 09/31] Add architecture to docker image name. --- .github/workflows/docker.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d72c733f2f..16c27367bf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -38,11 +38,10 @@ jobs: context: . file: docker/Dockerfile push: false - tags: cadabra2-jupyter:latest - outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar + tags: cadabra2-jupyter-${{ matrix.arch }}:latest + outputs: type=docker - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: cadabra2-jupyter - path: cadabra2-jupyter-${{ matrix.arch }}.tar + name: cadabra2-jupyter-${{ matrix.arch }} From abb21c749a3d3737bf48da5b70929eb7c8975bb4 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 18:06:59 +0200 Subject: [PATCH 10/31] Add architecture to docker image name. --- .github/workflows/docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 16c27367bf..37312e27ec 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,9 +8,9 @@ jobs: strategy: fail-fast: false matrix: - platform: - - linux/amd64 - - linux/arm64 + arch: + - amd64 + - arm64 steps: - name: Prepare @@ -33,7 +33,7 @@ jobs: - name: Build Docker image uses: docker/build-push-action@v4 with: - platforms: ${{ matrix.platform }} + platforms: linux/${{ matrix.arch }} labels: ${{ steps.meta.outputs.labels }} context: . file: docker/Dockerfile From 87e18bfeb4095f9c491711ce919ff6d6c6cb352f Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 19:15:50 +0200 Subject: [PATCH 11/31] Fix docker export --- .github/workflows/docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 37312e27ec..f040466847 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,9 +39,10 @@ jobs: file: docker/Dockerfile push: false tags: cadabra2-jupyter-${{ matrix.arch }}:latest - outputs: type=docker + outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - name: Upload artifact uses: actions/upload-artifact@v4 with: name: cadabra2-jupyter-${{ matrix.arch }} + path: cadabra2-jupyter-${{ matrix.arch }}.tar \ No newline at end of file From 8e42149e02b41f0362039ac599236e2d5b37d0fd Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 22:40:07 +0200 Subject: [PATCH 12/31] Fix installation path in docker container. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 3162c07c76..1892d09bfe 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,7 +41,7 @@ RUN apt update && apt install -y \ && rm -rf /var/lib/apt/lists/* RUN pip install jupyter COPY --from=builder /usr/local/bin/cadabra* /usr/local/bin/ -COPY --from=builder /usr/local/lib/python3.11/dist-packages /usr/local/lib/python3.11/dist-packages +COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages COPY --from=builder /usr/local/share/cadabra2 /usr/local/share/cadabra2 COPY --from=builder /usr/local/share/jupyter/kernels/cadabra2 /usr/local/share/jupyter/kernels/cadabra2 From 5ce5032f3be9d02758c085fd38f7017c703d8bae Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 23:24:44 +0200 Subject: [PATCH 13/31] Attempt uploading docker image to dockerhub automatically. --- .github/workflows/docker.yml | 37 ++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f040466847..2fb74a6908 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,12 +5,21 @@ on: [push] jobs: build: runs-on: ubuntu-latest + + # If we are on the master branch, build for all architectures. + # Otherwise, only build on the architecture for which we can + # get a runner (for speed). strategy: fail-fast: false - matrix: - arch: - - amd64 - - arm64 + if: ${{ github.ref == "master" }} + matrix: + arch: + - amd64 + - arm64 + if: ${{ github.ref != "master" }} + matrix: + arch: + - amd64 steps: - name: Prepare @@ -23,10 +32,22 @@ jobs: - uses: actions/checkout@v3 - - name: Exit if not on devel branch - if: github.ref != 'refs/heads/devel' + - name: Exit if not on master branch + if: github.ref != 'refs/heads/master' run: exit 1 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: kpeeters/cadabra2-jupyter + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -37,11 +58,11 @@ jobs: labels: ${{ steps.meta.outputs.labels }} context: . file: docker/Dockerfile - push: false + push: ${{ github.ref == "master" }} tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - - name: Upload artifact + - name: Upload artifact to github assets uses: actions/upload-artifact@v4 with: name: cadabra2-jupyter-${{ matrix.arch }} From 31ca86289ad7402421af0c10f35b00d9ce788881 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sun, 4 Aug 2024 23:27:21 +0200 Subject: [PATCH 14/31] Fix docker.yml --- .github/workflows/docker.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2fb74a6908..1bc2c9954f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,14 +12,14 @@ jobs: strategy: fail-fast: false if: ${{ github.ref == "master" }} - matrix: - arch: - - amd64 - - arm64 + matrix: + arch: + - amd64 + - arm64 if: ${{ github.ref != "master" }} - matrix: - arch: - - amd64 + matrix: + arch: + - amd64 steps: - name: Prepare From 80ac8e691c3dff464dacf33d0961e03dfec3e051 Mon Sep 17 00:00:00 2001 From: fjebaker Date: Fri, 9 Aug 2024 14:44:18 +0100 Subject: [PATCH 15/31] feat: add entrypoint for dockerfile to set python path --- docker/Dockerfile | 5 +++-- docker/entrypoint.sh | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 docker/entrypoint.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 1892d09bfe..40bd20b594 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,7 +48,8 @@ COPY --from=builder /usr/local/share/jupyter/kernels/cadabra2 /usr/local/share/j # Cleanup things not necessary for running the container. RUN apt-get remove -y gcc && apt-get autoremove -y -ENV PYTHONPATH=${PYTHONPATH}:/usr/local/lib/python3.11/dist-packages EXPOSE 9057 WORKDIR /home/cadabra -ENTRYPOINT ["jupyter", "notebook", "--ip=0.0.0.0", "--port=9057", "--allow-root"] +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh", "--port=9057"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000000..793f116d45 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# amend python path +export PYTHONPATH=${PYTHONPATH}:/usr/local/lib/python3.11/dist-packages +jupyter notebook --ip=0.0.0.0 --allow-root $@ From 9e347b00730870773a61438958ea03d25c918078 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 19:13:54 +0200 Subject: [PATCH 16/31] Update docker.yml to always use current master/main for various github actions. --- .github/workflows/docker.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1bc2c9954f..69fd4739a4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,7 +28,7 @@ jobs: echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@master - uses: actions/checkout@v3 @@ -37,22 +37,22 @@ jobs: run: exit 1 - name: Log in to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@master with: images: kpeeters/cadabra2-jupyter - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@master - name: Build Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@master with: platforms: linux/${{ matrix.arch }} labels: ${{ steps.meta.outputs.labels }} @@ -63,7 +63,7 @@ jobs: outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - name: Upload artifact to github assets - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: cadabra2-jupyter-${{ matrix.arch }} path: cadabra2-jupyter-${{ matrix.arch }}.tar \ No newline at end of file From 284380bda63df6b4147f3e8d7c55d232ec915404 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 19:16:27 +0200 Subject: [PATCH 17/31] Remove the branch-dependent architecture switch (github actions are a pain). --- .github/workflows/docker.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 69fd4739a4..b86c8bb248 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,15 +11,10 @@ jobs: # get a runner (for speed). strategy: fail-fast: false - if: ${{ github.ref == "master" }} matrix: arch: - amd64 - arm64 - if: ${{ github.ref != "master" }} - matrix: - arch: - - amd64 steps: - name: Prepare From a9306008185602dd2d4f6b5528ab11254420e843 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 21:18:09 +0200 Subject: [PATCH 18/31] Another attempt at docker CI --- .github/workflows/docker.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b86c8bb248..e9d7d7a454 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,3 +1,11 @@ + +# Build docker images with a Jupyter server with Cadabra +# kernel whenever a commit is pushed to github. +# +# Lint this thing with +# +# yq eval docker.yml + name: Docker on: [push] @@ -6,9 +14,6 @@ jobs: build: runs-on: ubuntu-latest - # If we are on the master branch, build for all architectures. - # Otherwise, only build on the architecture for which we can - # get a runner (for speed). strategy: fail-fast: false matrix: @@ -53,7 +58,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} context: . file: docker/Dockerfile - push: ${{ github.ref == "master" }} + push: ${{ github.ref == 'master' }} tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar From 48c42297a3e9420bdc78355a1ffb0d45f6eab742 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 21:20:26 +0200 Subject: [PATCH 19/31] Another attempt at docker CI --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e9d7d7a454..bb43343ea7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -32,9 +32,9 @@ jobs: - uses: actions/checkout@v3 - - name: Exit if not on master branch - if: github.ref != 'refs/heads/master' - run: exit 1 +# - name: Exit if not on master branch +# if: github.ref != 'refs/heads/master' +# run: exit 1 - name: Log in to Docker Hub uses: docker/login-action@master From 33e0ac127e48026e718f607a2d6780b59efb6d32 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 21:25:39 +0200 Subject: [PATCH 20/31] Fix a context issue for docker builds --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bb43343ea7..85d1edc9b1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -56,8 +56,8 @@ jobs: with: platforms: linux/${{ matrix.arch }} labels: ${{ steps.meta.outputs.labels }} - context: . - file: docker/Dockerfile + context: docker + file: Dockerfile push: ${{ github.ref == 'master' }} tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar From e15e6f55a82161ae161d8333658526b7ecbd6259 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 21:28:55 +0200 Subject: [PATCH 21/31] Fix a context issue for docker builds --- .github/workflows/docker.yml | 4 ++-- docker/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 85d1edc9b1..bb43343ea7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -56,8 +56,8 @@ jobs: with: platforms: linux/${{ matrix.arch }} labels: ${{ steps.meta.outputs.labels }} - context: docker - file: Dockerfile + context: . + file: docker/Dockerfile push: ${{ github.ref == 'master' }} tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar diff --git a/docker/Dockerfile b/docker/Dockerfile index 40bd20b594..08a0d165a2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -50,6 +50,6 @@ RUN apt-get remove -y gcc && apt-get autoremove -y EXPOSE 9057 WORKDIR /home/cadabra -COPY entrypoint.sh /entrypoint.sh +COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh", "--port=9057"] From 1c463986b4a3a610a801fbd69019e7df5c083a02 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 21:57:54 +0200 Subject: [PATCH 22/31] Testing docker labels/tags. --- .github/workflows/docker.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bb43343ea7..daf742e5a0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: matrix: arch: - amd64 - - arm64 +# - arm64 steps: - name: Prepare @@ -55,11 +55,12 @@ jobs: uses: docker/build-push-action@master with: platforms: linux/${{ matrix.arch }} - labels: ${{ steps.meta.outputs.labels }} context: . file: docker/Dockerfile - push: ${{ github.ref == 'master' }} - tags: cadabra2-jupyter-${{ matrix.arch }}:latest + push: true + #${{ github.ref == 'master' }} + labels: ${{ steps.meta.outputs.labels }} + tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - name: Upload artifact to github assets From 5fcfef4c602f609f7e79e829b6b6064c386ff2fe Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 22:00:19 +0200 Subject: [PATCH 23/31] Testing docker labels/tags. --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index daf742e5a0..620a833b4f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -50,7 +50,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@master - + - name: Build Docker image uses: docker/build-push-action@master with: @@ -58,7 +58,7 @@ jobs: context: . file: docker/Dockerfile push: true - #${{ github.ref == 'master' }} +#${{ github.ref == 'master' }} labels: ${{ steps.meta.outputs.labels }} tags: cadabra2-jupyter-${{ matrix.arch }}:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar @@ -67,4 +67,4 @@ jobs: uses: actions/upload-artifact@main with: name: cadabra2-jupyter-${{ matrix.arch }} - path: cadabra2-jupyter-${{ matrix.arch }}.tar \ No newline at end of file + path: cadabra2-jupyter-${{ matrix.arch }}.tar From 57122aad5d6f5e416e9ea63b2e5a09f8744c65ad Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 22:08:55 +0200 Subject: [PATCH 24/31] Attempt to fix docker push. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 620a833b4f..c06c0581ee 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -60,7 +60,7 @@ jobs: push: true #${{ github.ref == 'master' }} labels: ${{ steps.meta.outputs.labels }} - tags: cadabra2-jupyter-${{ matrix.arch }}:latest + tags: kpeeters/cadabra2-jupyter:latest outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar - name: Upload artifact to github assets From 948543b55b77148d13b38db5c00a96a1bf3b2fc8 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 22:40:06 +0200 Subject: [PATCH 25/31] Turn on arm64 builds again. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c06c0581ee..67e9effb99 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: matrix: arch: - amd64 -# - arm64 + - arm64 steps: - name: Prepare From 116b760f141c07c188e0085f64763fc14c3ba7e3 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 23:52:29 +0200 Subject: [PATCH 26/31] Attempt to fix dockerhub overwriting architectures, see https://github.com/docker/build-push-action/discussions/1039. --- .github/workflows/docker.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 67e9effb99..76b51fba0a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,12 +14,12 @@ jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arch: - - amd64 - - arm64 +# strategy: +# fail-fast: false +# matrix: +# arch: +# - amd64 +# - arm64 steps: - name: Prepare @@ -54,17 +54,17 @@ jobs: - name: Build Docker image uses: docker/build-push-action@master with: - platforms: linux/${{ matrix.arch }} + platforms: linux/amd64, linux/arm64 context: . file: docker/Dockerfile push: true #${{ github.ref == 'master' }} labels: ${{ steps.meta.outputs.labels }} tags: kpeeters/cadabra2-jupyter:latest - outputs: type=docker,dest=cadabra2-jupyter-${{ matrix.arch }}.tar + outputs: type=docker - - name: Upload artifact to github assets - uses: actions/upload-artifact@main - with: - name: cadabra2-jupyter-${{ matrix.arch }} - path: cadabra2-jupyter-${{ matrix.arch }}.tar +# - name: Upload artifact to github assets +# uses: actions/upload-artifact@main +# with: +# name: cadabra2-jupyter-${{ matrix.arch }} +# path: cadabra2-jupyter-${{ matrix.arch }}.tar From 75913483ed1624a7fb5bef8e942555ef75ddae8c Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 9 Aug 2024 23:54:10 +0200 Subject: [PATCH 27/31] Attempt to fix dockerhub overwriting architectures, see https://github.com/docker/build-push-action/discussions/1039. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 76b51fba0a..ecd94e1944 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -61,7 +61,7 @@ jobs: #${{ github.ref == 'master' }} labels: ${{ steps.meta.outputs.labels }} tags: kpeeters/cadabra2-jupyter:latest - outputs: type=docker +# outputs: type=docker # - name: Upload artifact to github assets # uses: actions/upload-artifact@main From 6adf91fc3f7e956d114df2ca33f6118ab0def39f Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Sat, 10 Aug 2024 11:38:44 +0200 Subject: [PATCH 28/31] Update web pages. --- web2/cadabra2/source/download.html | 14 +++++++++++++ web2/cadabra2/source/jupyter.html | 13 +++++++++++- .../source/static/images/docker-logo-blue.svg | 21 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 web2/cadabra2/source/static/images/docker-logo-blue.svg diff --git a/web2/cadabra2/source/download.html b/web2/cadabra2/source/download.html index 9c1f376395..831e0061f2 100644 --- a/web2/cadabra2/source/download.html +++ b/web2/cadabra2/source/download.html @@ -118,6 +118,20 @@

Binary packages

+
+ +
+ If you only want to use Cadabra from within Jupyter, you can use + the official + Docker image at DockerHub. This container exposes the + Jupyter server on a local URL which you can access using your + browser, and stores notebooks in your home directory. Available + for both AMD64 and ARM64 architectures. Be aware that you will + miss out on some of the goodies of the Cadabra notebook + interface. +
+
+
macOS
diff --git a/web2/cadabra2/source/jupyter.html b/web2/cadabra2/source/jupyter.html index e82f07b4a9..399069e1a0 100644 --- a/web2/cadabra2/source/jupyter.html +++ b/web2/cadabra2/source/jupyter.html @@ -42,7 +42,18 @@

Installation

to adjust your PYTHONPATH.

-