Repository navigation
209 lines (186 loc) · 7.36 KB
/
Copy pathdocker.yml
File metadata and controls
209 lines (186 loc) · 7.36 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Build and push docker
on:
workflow_call:
inputs:
tag:
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'dev'
type: choice
options:
- dev
- latest
env:
APOLLO_CLI_REGISTRY_IMAGE: ghcr.io/gmod/apollo-cli
APOLLO_CS_REGISTRY_IMAGE: ghcr.io/gmod/apollo-collaboration-server
jobs:
build-docker:
name: Build Docker images
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
artifactName: linux-amd64
- platform: linux/arm64
runner: ubuntu-24.04-arm
artifactName: linux-arm64
runs-on: ${{ matrix.runner }}
steps:
- name: Check out
uses: actions/checkout@v7
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v4
- name: Get CLI image Docker metadata
id: meta-cli
uses: docker/metadata-action@v6
with:
images: ${{ env.APOLLO_CLI_REGISTRY_IMAGE }}
labels: |
org.opencontainers.image.title=Apollo CLI
org.opencontainers.image.description=CLI tool interacting with the Apollo Collaboration Server
- name: Get Collaboration Server image Docker metadata
id: meta-cs
uses: docker/metadata-action@v6
with:
images: ${{ env.APOLLO_CS_REGISTRY_IMAGE }}
labels: |
org.opencontainers.image.title=Apollo Collaboration Server
org.opencontainers.image.description=Backend server for the Apollo genome annotation tool
- name: Build and push CLI image by digest
id: build-cli
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ env.APOLLO_CLI_REGISTRY_IMAGE }}
file:
${{ inputs.tag == 'dev' && 'packages/apollo-cli/dev.Dockerfile' ||
'packages/apollo-cli/Dockerfile' }}
outputs: type=image,push-by-digest=true,name-canonical=true
labels: ${{ steps.meta-cli.outputs.labels }}
cache-from: type=registry,ref=${{ env.APOLLO_CLI_REGISTRY_IMAGE }}
cache-to: type=inline
- name: Export digests of CLI image
run: |
digestdir=${{ runner.temp }}/digests-cli
mkdir -p "${digestdir}"
digest="${{ steps.build-cli.outputs.digest }}"
touch "${digestdir}/${digest#sha256:}"
- name: Upload digests of CLI image
uses: actions/upload-artifact@v7
with:
name: digests-cli-${{ matrix.artifactName }}
path: ${{ runner.temp }}/digests-cli/*
if-no-files-found: error
retention-days: 1
- name: Build and push Collaboration Server image by digest
id: build-cs
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ env.APOLLO_CS_REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true
labels: ${{ steps.meta-cs.outputs.labels }}
cache-from: type=registry,ref=${{ env.APOLLO_CS_REGISTRY_IMAGE }}
cache-to: type=inline
- name: Export digests of Collaboration Server image
run: |
digestdir=${{ runner.temp }}/digests-cs
mkdir -p "${digestdir}"
digest="${{ steps.build-cs.outputs.digest }}"
touch "${digestdir}/${digest#sha256:}"
- name: Upload digests of Collaboration Server image
uses: actions/upload-artifact@v7
with:
name: digests-cs-${{ matrix.artifactName }}
path: ${{ runner.temp }}/digests-cs/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build-docker
steps:
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v4
- name: Get CLI image Docker metadata
id: meta-cli
uses: docker/metadata-action@v6
with:
images: ${{ env.APOLLO_CLI_REGISTRY_IMAGE }}
labels: |
org.opencontainers.image.title=Apollo CLI
org.opencontainers.image.description=CLI tool interacting with the Apollo Collaboration Server
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Get Collaboration Server image Docker metadata
id: meta-cs
uses: docker/metadata-action@v6
with:
images: ${{ env.APOLLO_CS_REGISTRY_IMAGE }}
labels: |
org.opencontainers.image.title=Apollo Collaboration Server
org.opencontainers.image.description=Backend server for the Apollo genome annotation tool
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Download digests CLI image
uses: actions/download-artifact@v8
with:
path: ${{ runner.temp }}/digests-cli
pattern: digests-cli-*
merge-multiple: true
- name: Create manifest list and push CLI image
working-directory: ${{ runner.temp }}/digests-cli
run: |
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.title=Apollo CLI" \
--annotation "index:org.opencontainers.image.description=CLI tool interacting with the Apollo Collaboration Server" \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta-cli.outputs.json }}') \
--tag ${{ env.APOLLO_CLI_REGISTRY_IMAGE }}:${{ inputs.tag }} \
$(printf '${{ env.APOLLO_CLI_REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect CLI image
run: |
docker buildx imagetools inspect \
${{ env.APOLLO_CLI_REGISTRY_IMAGE }}:${{ inputs.tag }}
- name: Download digests Collaboration Server image
uses: actions/download-artifact@v8
with:
path: ${{ runner.temp }}/digests-cs
pattern: digests-cs-*
merge-multiple: true
- name: Create manifest list and push Collaboration Server image
working-directory: ${{ runner.temp }}/digests-cs
run: |
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.title=Apollo Collaboration Server" \
--annotation "index:org.opencontainers.image.description=Backend server for the Apollo genome annotation tool" \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta-cs.outputs.json }}') \
--tag ${{ env.APOLLO_CS_REGISTRY_IMAGE }}:${{ inputs.tag }} \
$(printf '${{ env.APOLLO_CS_REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect Collaboration Server image
run: |
docker buildx imagetools inspect \
${{ env.APOLLO_CS_REGISTRY_IMAGE }}:${{ inputs.tag }}