-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (53 loc) · 1.62 KB
/
docker-image.yaml
File metadata and controls
61 lines (53 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: "GHCR: Command-Line Container"
# Builds the Underworld3 command-line Docker image and pushes to GHCR.
# Uses container/Containerfile (micromamba-based image for local use).
#
# This is separate from binder-image.yml which builds Binder-ready images
# optimized for mybinder.org.
on:
push:
branches: [main, development]
paths:
# Only rebuild when these files change
- 'container/Containerfile'
- 'environment.yaml'
- 'src/**/*.pyx'
- 'src/**/*.c'
- 'setup.py'
- 'pyproject.toml'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force full rebuild (no cache)'
type: boolean
default: false
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract branch name
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
file: container/Containerfile
platforms: linux/amd64
no-cache: ${{ inputs.force_rebuild || false }}
tags: |
ghcr.io/underworldcode/underworld3:${{ env.BRANCH }}
ghcr.io/underworldcode/underworld3:latest