forked from aiidateam/aiida-core
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.15 KB
/
docker-build.yml
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
name: Build Docker images and upload them to ghcr.io
env:
BUILDKIT_PROGRESS: plain
REGISTRY: ghcr.io/
on:
workflow_call:
inputs:
runsOn:
description: GitHub Actions Runner image
required: true
type: string
platforms:
description: Target platforms for the build (linux/amd64 and/or linux/arm64)
required: true
type: string
outputs:
images:
description: Images identified by digests
value: ${{ jobs.build.outputs.images }}
jobs:
build:
name: ${{ inputs.platforms }}
runs-on: ${{ inputs.runsOn }}
timeout-minutes: 60
defaults:
run:
# Make sure we fail if any command in a piped command sequence fails
shell: bash -e -o pipefail {0}
outputs:
images: ${{ steps.bake_metadata.outputs.images }}
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4
- name: Set up QEMU
if: ${{ inputs.platforms != 'linux/amd64' }}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry 🔑
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and upload to ghcr.io 📤
id: build
uses: docker/bake-action@v5
with:
push: true
workdir: .docker/
# Using provenance to disable default attestation so it will build only desired images:
# https://github.com/orgs/community/discussions/45969
provenance: false
set: |
*.platform=${{ inputs.platforms }}
*.output=type=registry,push-by-digest=true,name-canonical=true
*.cache-to=type=gha,scope=${{ github.workflow }},mode=max
*.cache-from=type=gha,scope=${{ github.workflow }}
files: |
docker-bake.hcl
build.json
- name: Set output variables
id: bake_metadata
run: |
.github/workflows/extract-docker-image-names.sh | tee -a "${GITHUB_OUTPUT}"
env:
BAKE_METADATA: ${{ steps.build.outputs.metadata }}