-
Notifications
You must be signed in to change notification settings - Fork 19
140 lines (121 loc) · 4.49 KB
/
runtime.yml
File metadata and controls
140 lines (121 loc) · 4.49 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Runtime Images
on:
push:
branches: [main, dev]
paths:
- 'Dockerfile'
- 'docker/requirements/**'
- '.github/workflows/runtime.yml'
workflow_dispatch:
concurrency:
group: runtime-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
RUNTIME_CORE_IMAGE: ghcr.io/${{ github.repository }}/runtime-core
RUNTIME_R_IMAGE: ghcr.io/${{ github.repository }}/runtime-r
BUILDCACHE_IMAGE: ghcr.io/${{ github.repository }}/buildcache
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
runtime_hash: ${{ steps.runtime.outputs.runtime_hash }}
steps:
- uses: actions/checkout@v4
- id: runtime
run: echo "runtime_hash=$(scripts/ci/compute_runtime_hash.sh)" >> "${GITHUB_OUTPUT}"
build-runtime-core:
needs: [prepare]
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: ubuntu-24.04
- arch: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish runtime-core
uses: docker/build-push-action@v6
with:
context: .
target: runtime-core
push: true
platforms: ${{ matrix.platform }}
provenance: false
tags: ${{ env.RUNTIME_CORE_IMAGE }}:${{ needs.prepare.outputs.runtime_hash }}-${{ matrix.arch }}
cache-from: |
type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:runtime-core-${{ matrix.arch }}
cache-to: type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:runtime-core-${{ matrix.arch }},mode=max
build-runtime-r:
needs: [prepare, build-runtime-core]
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: ubuntu-24.04
- arch: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish runtime-r
uses: docker/build-push-action@v6
with:
context: .
target: runtime-r
push: true
platforms: ${{ matrix.platform }}
provenance: false
tags: ${{ env.RUNTIME_R_IMAGE }}:${{ needs.prepare.outputs.runtime_hash }}-${{ matrix.arch }}
cache-from: |
type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:runtime-core-${{ matrix.arch }}
type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:runtime-r-${{ matrix.arch }}
cache-to: type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:runtime-r-${{ matrix.arch }},mode=max
- name: Smoke test runtime-r
run: |
docker pull "${RUNTIME_R_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-${{ matrix.arch }}"
docker run --rm "${RUNTIME_R_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-${{ matrix.arch }}" \
bash -lc "python3 --version && R --quiet -e 'cat(1 + 1)' && nsjail --help >/dev/null"
publish-manifests:
needs: [prepare, build-runtime-core, build-runtime-r]
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish runtime manifests
run: |
docker buildx imagetools create \
-t "${RUNTIME_CORE_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}" \
"${RUNTIME_CORE_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-amd64" \
"${RUNTIME_CORE_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-arm64"
docker buildx imagetools create \
-t "${RUNTIME_R_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}" \
"${RUNTIME_R_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-amd64" \
"${RUNTIME_R_IMAGE}:${{ needs.prepare.outputs.runtime_hash }}-arm64"