Skip to content

chore(jupyter): Update uv.lock and release please config to update it #16

chore(jupyter): Update uv.lock and release please config to update it

chore(jupyter): Update uv.lock and release please config to update it #16

name: docker-jupyter-hub-all
permissions:
contents: read
on:
push:
branches: [main]
tags: ['cogstack-jupyter-hub-v*.*.*']
paths:
- "apps/cogstack-jupyter-hub/**"
- ".github/workflows/docker-build.yml"
pull_request:
paths:
- "apps/cogstack-jupyter-hub/**"
- ".github/workflows/docker-build.yml"
workflow_dispatch:
concurrency:
group: docker-jupyter-all-${{ github.ref }}
cancel-in-progress: true
jobs:
# ---------- AMD64 ----------
build-amd64:
runs-on: ubuntu-22.04
if: github.event_name == 'push'
outputs:
hub_digest: ${{ steps.hub.outputs.digest }}
su_digest: ${{ steps.su.outputs.digest }}
steps:
- uses: actions/checkout@v7
with: { submodules: recursive, fetch-depth: 0 }
- uses: docker/setup-buildx-action@v4
- name: Docker meta (hub)
id: meta_hub
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-hub
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Docker meta (singleuser)
id: meta_su
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-singleuser
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push hub (amd64)
id: hub
uses: docker/build-push-action@v7
with:
context: apps/cogstack-jupyter-hub
file: apps/cogstack-jupyter-hub/Dockerfile_hub
platforms: linux/amd64
build-args: |
CPU_ARCHITECTURE=amd64
GPU_BUILD=false
tags: ${{ steps.meta_hub.outputs.tags }}
labels: ${{ steps.meta_hub.outputs.labels }}
cache-from: type=gha,scope=hub-amd64
cache-to: type=gha,mode=max,scope=hub-amd64
provenance: false
push: true
- name: Build & push singleuser (amd64)
id: su
uses: docker/build-push-action@v7
with:
context: apps/cogstack-jupyter-hub
file: apps/cogstack-jupyter-hub/Dockerfile_singleuser
platforms: linux/amd64
build-args: |
CPU_ARCHITECTURE=amd64
GPU_BUILD=false
tags: ${{ steps.meta_su.outputs.tags }}
labels: ${{ steps.meta_su.outputs.labels }}
cache-from: type=gha,scope=singleuser-amd64
cache-to: type=gha,mode=max,scope=singleuser-amd64
provenance: false
push: true
# ---------- ARM64 ----------
build-arm64:
runs-on: ubuntu-22.04-arm
if: github.event_name == 'push'
outputs:
hub_digest: ${{ steps.hub.outputs.digest }}
su_digest: ${{ steps.su.outputs.digest }}
steps:
- uses: actions/checkout@v7
with: { submodules: recursive, fetch-depth: 0 }
- uses: docker/setup-buildx-action@v4
- name: Docker meta (hub)
id: meta_hub
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-hub
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Docker meta (singleuser)
id: meta_su
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-singleuser
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push hub (arm64)
id: hub
uses: docker/build-push-action@v7
with:
context: apps/cogstack-jupyter-hub
file: apps/cogstack-jupyter-hub/Dockerfile_hub
platforms: linux/arm64
build-args: |
CPU_ARCHITECTURE=arm64
GPU_BUILD=false
tags: ${{ steps.meta_hub.outputs.tags }}
labels: ${{ steps.meta_hub.outputs.labels }}
cache-from: type=gha,scope=hub-arm64
cache-to: type=gha,mode=max,scope=hub-arm64
provenance: false
push: true
- name: Build & push singleuser (arm64)
id: su
uses: docker/build-push-action@v7
with:
context: apps/cogstack-jupyter-hub
file: apps/cogstack-jupyter-hub/Dockerfile_singleuser
platforms: linux/arm64
build-args: |
CPU_ARCHITECTURE=arm64
GPU_BUILD=false
tags: ${{ steps.meta_su.outputs.tags }}
labels: ${{ steps.meta_su.outputs.labels }}
cache-from: type=gha,scope=singleuser-arm64
cache-to: type=gha,mode=max,scope=singleuser-arm64
provenance: false
push: true
# ---------- GPU (unchanged, amd64-only) ----------
build-gpu:
runs-on: ubuntu-22.04
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v7
with: { submodules: recursive, fetch-depth: 0 }
- uses: docker/setup-buildx-action@v4
- name: Docker meta (singleuser-gpu)
id: meta_gpu
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-singleuser-gpu
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android
sudo apt-get clean
docker system prune -af --volumes || true
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push singleuser GPU (amd64)
uses: docker/build-push-action@v7
with:
context: apps/cogstack-jupyter-hub
file: apps/cogstack-jupyter-hub/Dockerfile_singleuser
platforms: linux/amd64
build-args: |
CPU_ARCHITECTURE=amd64
GPU_BUILD=true
tags: ${{ steps.meta_gpu.outputs.tags }}
labels: ${{ steps.meta_gpu.outputs.labels }}
cache-from: type=gha,scope=singleuser-gpu-amd64
cache-to: type=gha,mode=max,scope=singleuser-gpu-amd64
provenance: false
push: true
manifest:
runs-on: ubuntu-22.04
if: github.event_name == 'push'
needs: [build-amd64, build-arm64]
steps:
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Recompute tags (must match both builds)
- name: Docker meta (hub)
id: meta_hub
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-hub
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Docker meta (singleuser)
id: meta_su
uses: docker/metadata-action@v6
with:
images: cogstacksystems/jupyter-singleuser
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable={{is_default_branch}}
type=match,pattern=cogstack-jupyter-hub-v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Create hub multi-arch manifests
shell: bash
env:
AMD64: ${{ needs.build-amd64.outputs.hub_digest }}
ARM64: ${{ needs.build-arm64.outputs.hub_digest }}
run: |
set -euo pipefail
# must have both digests
if [ -z "${AMD64:-}" ] || [ -z "${ARM64:-}" ]; then
echo "Missing hub digests (amd64='${AMD64:-}', arm64='${ARM64:-}')."
exit 1
fi
while IFS= read -r ref; do
[[ -z "$ref" ]] && continue
img="${ref%%:*}"
tag="${ref#*:}"
# normalize: if tag starts with 'v', strip it (v2.0.9 -> 2.0.9)
if [[ "$tag" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "normalize: $img:$tag -> $img:${tag#v}"
tag="${tag#v}"
fi
echo "⛵ ${img}:${tag}"
docker buildx imagetools create \
--tag "${img}:${tag}" \
"${img}@${AMD64}" \
"${img}@${ARM64}"
done < <(printf "%s" "${{ steps.meta_hub.outputs.tags }}")
- name: Create singleuser multi-arch manifests
shell: bash
env:
AMD64: ${{ needs.build-amd64.outputs.su_digest }}
ARM64: ${{ needs.build-arm64.outputs.su_digest }}
run: |
set -euo pipefail
# must have both digests
if [ -z "${AMD64:-}" ] || [ -z "${ARM64:-}" ]; then
echo "Missing singleuser digests (amd64='${AMD64:-}', arm64='${ARM64:-}')."
exit 1
fi
# stitch each tag from the singleuser meta
while IFS= read -r ref; do
[[ -z "$ref" ]] && continue
img="${ref%%:*}"
tag="${ref#*:}"
# normalize: if tag starts with 'v', strip it (v2.0.9 -> 2.0.9)
if [[ "$tag" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "normalize: $img:$tag -> $img:${tag#v}"
tag="${tag#v}"
fi
echo "⛵ ${img}:${tag}"
docker buildx imagetools create \
--tag "${img}:${tag}" \
"${img}@${AMD64}" \
"${img}@${ARM64}"
done < <(printf "%s" "${{ steps.meta_su.outputs.tags }}")