|
| 1 | +# .github/workflows/build.yml |
| 2 | +name: Build Jupyter Coder Images |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + paths: |
| 9 | + - "images/**" |
| 10 | + - ".github/workflows/build.yml" |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + base: |
| 22 | + - jupyter/minimal-notebook:latest |
| 23 | + - jupyter/scipy-notebook:latest |
| 24 | + # - jupyter/datascience-notebook:latest |
| 25 | + # - jupyter/tensorflow-notebook:latest |
| 26 | + # - jupyter/pytorch-notebook:latest |
| 27 | + # - jupyter/r-notebook:latest |
| 28 | + # - jupyter/all-spark-notebook:latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Set up QEMU |
| 33 | + uses: docker/setup-qemu-action@v3 |
| 34 | + |
| 35 | + - name: Set up Docker Buildx |
| 36 | + uses: docker/setup-buildx-action@v3 |
| 37 | + |
| 38 | + - name: Log in to GHCR |
| 39 | + uses: docker/login-action@v3 |
| 40 | + with: |
| 41 | + registry: ghcr.io |
| 42 | + username: ${{ github.actor }} |
| 43 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + - name: Derive image names |
| 46 | + id: names |
| 47 | + run: | |
| 48 | + BASE="${{ matrix.base }}" |
| 49 | + # e.g., jupyter/scipy-notebook:latest -> scipy-notebook |
| 50 | + NAME="$(echo "$BASE" | awk -F'[/:]' '{print $(NF-1)}')" |
| 51 | + echo "name=$NAME" >> $GITHUB_OUTPUT |
| 52 | + # Tag scheme: ghcr.io/org/repo/<stack>:<upstream-tag>-coder |
| 53 | + OWNER="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" |
| 54 | + REPO="$(echo '${{ github.repository }}' | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')" |
| 55 | + echo "image=ghcr.io/$OWNER/$REPO/$NAME" >> $GITHUB_OUTPUT |
| 56 | +
|
| 57 | + - name: Build & Push |
| 58 | + uses: docker/build-push-action@v6 |
| 59 | + with: |
| 60 | + context: . |
| 61 | + file: images/jupyter/Dockerfile |
| 62 | + build-args: | |
| 63 | + BASE_IMAGE=${{ matrix.base }} |
| 64 | + platforms: linux/amd64 |
| 65 | + push: true |
| 66 | + tags: | |
| 67 | + ${{ steps.names.outputs.image }}:latest |
| 68 | + # Optional: mirror upstream tag (e.g., 2024-09-01), if you parse it. |
| 69 | + cache-from: type=gha |
| 70 | + cache-to: type=gha,mode=max |
0 commit comments