Added GitHub actions to build images; cleaned up dir structure for pa… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/build.yml | |
| name: Build Jupyter Coder Images | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - "images/**" | |
| - ".github/workflows/build.yml" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| base: | |
| - jupyter/minimal-notebook:latest | |
| - jupyter/scipy-notebook:latest | |
| # - jupyter/datascience-notebook:latest | |
| # - jupyter/tensorflow-notebook:latest | |
| # - jupyter/pytorch-notebook:latest | |
| # - jupyter/r-notebook:latest | |
| # - jupyter/all-spark-notebook:latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Derive image names | |
| id: names | |
| run: | | |
| BASE="${{ matrix.base }}" | |
| # e.g., jupyter/scipy-notebook:latest -> scipy-notebook | |
| NAME="$(echo "$BASE" | awk -F'[/:]' '{print $(NF-1)}')" | |
| echo "name=$NAME" >> $GITHUB_OUTPUT | |
| # Tag scheme: ghcr.io/org/repo/<stack>:<upstream-tag>-coder | |
| OWNER="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" | |
| REPO="$(echo '${{ github.repository }}' | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')" | |
| echo "image=ghcr.io/$OWNER/$REPO/$NAME" >> $GITHUB_OUTPUT | |
| - name: Build & Push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: images/jupyter/Dockerfile | |
| build-args: | | |
| BASE_IMAGE=${{ matrix.base }} | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ steps.names.outputs.image }}:latest | |
| # Optional: mirror upstream tag (e.g., 2024-09-01), if you parse it. | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |