-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (82 loc) · 3.07 KB
/
Copy pathdocker.yml
File metadata and controls
93 lines (82 loc) · 3.07 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Build & publish the Dulus Docker image to GitHub Container Registry.
#
# Triggers:
# - Push to main → updates ghcr.io/kevrojo/dulus:latest
# - Push of a v* tag → adds ghcr.io/kevrojo/dulus:<version> + updates latest
# - Manual dispatch → rebuild on demand
#
# Builds multi-arch (amd64 + arm64) so Apple Silicon Macs and ARM servers
# (Graviton, Raspberry Pi 5, etc.) get a native image — no QEMU emulation.
name: docker
on:
push:
branches: [main]
tags: ["v*"]
# Docs-only commits (README, news, changelog, the investor deck, i18n
# READMEs, images) don't change the image — skip the ~15-min multi-arch
# build for them. Tag pushes (v*) still build regardless, since a release
# commit also bumps the code. This keeps frequent docs pushes from flashing
# a red X when GitHub's action CDN rate-limits the buildx/qemu download.
paths-ignore:
- "**/*.md"
- "docs/**"
- "**/*.pdf"
- "**/*.png"
- "**/*.jpg"
- "**/*.svg"
workflow_dispatch:
# A newer push to the same ref supersedes any in-flight build for that ref,
# so stale builds get cancelled instead of hogging runners for 15+ min.
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/dulus
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 30 # normal multi-arch build ~9 min; 30 catches true hangs
permissions:
contents: read
packages: write # required to push to ghcr.io
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU (for cross-arch builds)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Compute tags:
# - on a tag push (refs/tags/v3.1.0) → ghcr.io/.../dulus:3.1.0 + :latest
# - on a main push → ghcr.io/.../dulus:latest
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push (multi-arch)
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
DULUS_SOURCE=local
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# GHA cache speeds repeated builds from ~5 min to ~1 min when the
# Dockerfile layers haven't changed.
cache-from: type=gha
cache-to: type=gha,mode=max