Skip to content

Commit 2fa5cea

Browse files
committed
Update GitHub Actions workflow for binder image builds
- Fix Dockerfile path (container/Dockerfile.base.optimized) - Switch from DockerHub to GHCR - Add path triggers for Cython/dependency changes - Add workflow_dispatch for manual builds - Add cross-repo dispatch to update launcher Developed by Underworld Team with AI assistance (Claude)
1 parent 69e28fe commit 2fa5cea

File tree

1 file changed

+50
-14
lines changed

1 file changed

+50
-14
lines changed

.github/workflows/docker-image.yml

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,69 @@
1-
name: Image Build and Push
1+
name: Build and Push Binder Image
2+
3+
# Builds the Underworld3 binder-ready Docker image and pushes to GHCR
4+
# The image is used by mybinder.org via the uw3-binder-launcher repository
25

36
on:
4-
push:
5-
branches:
6-
- development
7+
push:
8+
branches: [main, uw3-release-candidate, development]
9+
paths:
10+
# Only rebuild when these files change (Cython/dependencies require rebuild)
11+
- 'container/Dockerfile.base.optimized'
12+
- 'pixi.toml'
13+
- 'pixi.lock'
14+
- 'src/**/*.pyx'
15+
- 'src/**/*.c'
16+
- 'setup.py'
17+
workflow_dispatch:
18+
inputs:
19+
force_rebuild:
20+
description: 'Force full rebuild (no cache)'
21+
type: boolean
22+
default: false
723

824
jobs:
9-
push-to-dockerhub:
25+
build-and-push:
1026
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
1130

1231
steps:
1332
- name: Checkout repository
1433
uses: actions/checkout@v4
1534

16-
- name: Exact branch name
17-
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
1837

19-
- name: Login to DockerHub
38+
- name: Login to GHCR
2039
uses: docker/login-action@v3
2140
with:
22-
username: ${{ secrets.XXX_USERNAME }}
23-
password: ${{ secrets.XXX_PWORD }}
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Extract branch name
46+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
2447

2548
- name: Build and push Docker image
26-
uses: docker/build-push-action@v6
49+
uses: docker/build-push-action@v5
2750
with:
2851
context: .
52+
file: container/Dockerfile.base.optimized
2953
push: true
30-
file: ./Dockerfile
3154
platforms: linux/amd64
32-
# see https://github.com/docker/build-push-action/issues/276 for syntax help
33-
tags: underworldcode/underworld3:${{ env.BRANCH }} #-$(date +%s)
55+
no-cache: ${{ inputs.force_rebuild || false }}
56+
tags: |
57+
ghcr.io/underworldcode/uw3-base:${{ env.BRANCH }}-slim
58+
ghcr.io/underworldcode/uw3-base:latest-slim
59+
60+
# Trigger launcher repo to update its Dockerfile reference
61+
# Requires LAUNCHER_PAT secret (Personal Access Token with repo scope)
62+
- name: Trigger launcher update
63+
if: success()
64+
uses: peter-evans/repository-dispatch@v2
65+
with:
66+
token: ${{ secrets.LAUNCHER_PAT }}
67+
repository: underworldcode/uw3-binder-launcher
68+
event-type: image-updated
69+
client-payload: '{"branch": "${{ env.BRANCH }}"}'

0 commit comments

Comments
 (0)