From 1d0f3872663fc480faf67509f7cec84ee550166a Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 17 Oct 2024 02:00:18 +0900 Subject: [PATCH] Add workflow making wsl image --- .github/workflows/create-wsl-image.yml | 34 ++++++++++++++++++++++++++ Dockerfile | 2 +- README.rst | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/create-wsl-image.yml diff --git a/.github/workflows/create-wsl-image.yml b/.github/workflows/create-wsl-image.yml new file mode 100644 index 0000000..4b6d618 --- /dev/null +++ b/.github/workflows/create-wsl-image.yml @@ -0,0 +1,34 @@ +name: Build Docker Image and Export for WSL + +on: + schedule: + - cron: '0 2 * * *' # Run every day + workflow_dispatch: + +jobs: + build-and-export: + runs-on: ubuntu-latest + + steps: + - name: Prepare Dockerfile + run: | + curl -o Dockerfile https://raw.githubusercontent.com/sagemath/sage-binder-env/master/Dockerfile + sed -i '/COPY notebooks/d' Dockerfile # remove the line from Dockerfile + + - name: Extract version from Dockerfile + id: extract_version + run: | + VERSION=$(grep '^FROM ghcr.io/sagemath/sage-binder-env:' Dockerfile | sed 's/^FROM ghcr.io\/sagemath\/sage-binder-env://') + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Build and export Docker image + run: | + docker build -t sagemath-container . + export CONTAINER_ID=$(docker create sagemath-container) + docker export $CONTAINER_ID -o sagemath-$VERSION-wsl.tar + + - name: Upload tar file as artifact + uses: actions/upload-artifact@v3 + with: + name: sagemath-wsl-image + path: sagemath-${{ env.VERSION }}-wsl.tar diff --git a/Dockerfile b/Dockerfile index 9ffc008..afc1136 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Dockerfile for binder # Reference: https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html -FROM ghcr.io/sagemath/sage-binder-env:10.2 +FROM ghcr.io/sagemath/sage-binder-env:10.4 USER root diff --git a/README.rst b/README.rst index a246272..a2bca25 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ Extending the Dockerfile The `Dockerfile` is based on the Docker image:: - FROM ghcr.io/sagemath/sage-binder-env:10.2 + FROM ghcr.io/sagemath/sage-binder-env:10.4 which contains the latest stable version of Sage.