-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (75 loc) · 2.64 KB
/
Copy pathdocker.yml
File metadata and controls
85 lines (75 loc) · 2.64 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
name: Docker image
# Builds + pushes ghcr.io/ariomoniri/syntha:<tag> on every v* tag, plus a
# rolling :latest. Also builds on push-to-main as :main so users can pin
# to a bleeding-edge image if they want.
#
# Multi-platform: linux/amd64 + linux/arm64. arm64 build is ~3× slower
# but covers Apple-Silicon Docker Desktop and AWS Graviton.
on:
push:
branches: [main]
paths:
- "Dockerfile"
- ".dockerignore"
- "src/**"
- "pyproject.toml"
- ".github/workflows/docker.yml"
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
packages: write # required to push to GHCR
id-token: write # for sigstore / cosign keyless signing
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU (for arm64 cross-build)
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/syntha
# Auto-tag scheme:
# * main branch: :main
# * v* tag: :v0.5.0 + :0.5 + :0.5.0 + :latest
# * PRs (if enabled): :pr-NN
tags: |
type=raw,value=main,enable={{is_default_branch}}
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.title=syntha
org.opencontainers.image.description=Synthea-inspired hybrid synthetic patient record generator
- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: true
sbom: true
- name: Inspect produced image
if: ${{ steps.build.outputs.digest != '' }}
run: |
echo "Image digest: ${{ steps.build.outputs.digest }}"
echo "Tags: ${{ steps.meta.outputs.tags }}"