-
Notifications
You must be signed in to change notification settings - Fork 18
296 lines (255 loc) · 9.47 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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: Build all of the sirf docker images
on:
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- 'jupyterhub/**'
- 'VirtualBox/**'
- '.github/workflows/c-cpp.yml'
- 'CITATION.cff'
- '.mailmap'
push:
branches: [ master ]
paths-ignore:
- '**.md'
- 'jupyterhub/**'
- 'VirtualBox/**'
- '.github/workflows/c-cpp.yml'
jobs:
build-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install docker and pre-reqs and clean some disk-space
shell: bash -l {0}
run: |
sudo .github/workflows/install_docker.sh
sudo .github/workflows/GHA_increase_disk_space.sh
- name: Build docker core image
# Builds docker image from Docker file.
shell: bash -l {0}
run: |
docker-compose -f docker/docker-compose.yml build --pull core
- name : docker save core
# https://docs.docker.com/engine/reference/commandline/save/
shell: bash -l {0}
run: |
#docker save -o core.tar synerbi/sirf:core
docker image ls
docker save synerbi/sirf:core | gzip > core.tar.gz
ls -l
- name: Upload artifact of the core image.
uses: actions/[email protected]
with:
name: sirf-core
path: core.tar.gz
build-core-gpu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install docker and pre-reqs and clean some disk-space
shell: bash -l {0}
run: |
sudo .github/workflows/install_docker.sh
sudo .github/workflows/GHA_increase_disk_space.sh
- name: Build docker core-gpu image
# Builds docker image from Docker file.
shell: bash -l {0}
run: |
docker-compose -f docker/docker-compose.yml -f docker/docker-compose.srv-gpu.yml build --pull core
- name : docker save core-gpu
# https://docs.docker.com/engine/reference/commandline/save/
shell: bash -l {0}
run: |
docker image ls
docker save synerbi/sirf:core-gpu | gzip > core-gpu.tar.gz
ls -l
- name: Upload artifact of the core image.
uses: actions/[email protected]
with:
name: sirf-core-gpu
path: core-gpu.tar.gz
build-devel-and-latest:
runs-on: ubuntu-latest
needs: build-core
strategy:
matrix:
tag: ['latest', 'devel']
steps:
- uses: actions/checkout@v3
- name: Install docker and pre-reqs and clean some disk-space
shell: bash -l {0}
run: |
sudo .github/workflows/install_docker.sh
sudo .github/workflows/GHA_increase_disk_space.sh
- name: Download artifact of core image
uses: actions/download-artifact@v3
with:
name: sirf-core
path: /tmp
- name: load core
shell: bash -l {0}
run: |
docker load --input /tmp/core.tar.gz
- name: Build docker image
# Builds docker image from Docker file.
shell: bash -l {0}
run: |
set -ex;
compose_command="docker-compose -f docker/docker-compose.yml"
if [[ ${{ matrix.tag }} == 'devel' ]]; then compose_command="$compose_command -f docker/docker-compose.devel.yml"; fi
# $compose_command pull core
$compose_command build --pull sirf
echo "compose_command=$compose_command" >> $GITHUB_ENV
- name : docker save image
# https://docs.docker.com/engine/reference/commandline/save/
shell: bash -l {0}
run: |
echo "info on layers and their sizes from docker history:"
sirf_image=`docker image ls | grep ${{ matrix.tag }} | awk '/sirf/ { print $3}'`
docker history "$sirf_image"
docker save synerbi/sirf:${{ matrix.tag }} | gzip > ${{ matrix.tag }}.tar.gz
- name: Upload artifact of image.
uses: actions/[email protected]
with:
name: sirf-${{ matrix.tag }}
path: ${{ matrix.tag }}.tar.gz
build-service-gpu:
runs-on: ubuntu-latest
needs: build-core-gpu
steps:
- uses: actions/checkout@v3
- name: Install docker and pre-reqs and clean some disk-space
shell: bash -l {0}
run: |
sudo .github/workflows/install_docker.sh
sudo .github/workflows/GHA_increase_disk_space.sh
- name: Download artifact of core image
uses: actions/download-artifact@v3
with:
name: sirf-core-gpu
path: /tmp
- name: load core-gpu
shell: bash -l {0}
run: |
docker load --input /tmp/core-gpu.tar.gz
- name: Build docker service-gpu image
# Builds docker image from Docker file.
shell: bash -l {0}
run: |
set -ex;
# docker-compose -f docker/docker-compose.yml -f docker/docker-compose.srv-gpu.yml pull core
docker-compose -f docker/docker-compose.yml -f docker/docker-compose.srv-gpu.yml build --pull sirf
# Temporarily disabling the save and upload of the image as it is too big.
# see https://github.com/SyneRBI/SIRF-SuperBuild/issues/770
# - name : docker save image
# # https://docs.docker.com/engine/reference/commandline/save/
# shell: bash -l {0}
# run: |
# # first we must delete image that is no longer needed, to save space:
# docker rmi synerbi/sirf:core-gpu
# yes | docker system prune
# docker image ls
# docker save synerbi/sirf:service-gpu | gzip > service-gpu.tar.gz
# - name: Upload artifact of image.
# uses: actions/[email protected]
# with:
# name: sirf-service-gpu
# path: service-gpu.tar.gz
build-service-images:
runs-on: ubuntu-latest
needs: build-devel-and-latest
strategy:
matrix:
tag: ['service', 'devel-service']
steps:
- uses: actions/checkout@v3
- name: Install docker and pre-reqs and clean some disk-space
shell: bash -l {0}
run: |
sudo .github/workflows/install_docker.sh
sudo .github/workflows/GHA_increase_disk_space.sh
- name: setup variables
shell: bash -l {0}
run: |
compose_command="docker-compose -f docker/docker-compose.yml"
if [[ ${{ matrix.tag }} == 'service' ]];
then
echo "prereq_image_name="latest"" >> $GITHUB_ENV
compose_command="$compose_command -f docker/docker-compose.srv.yml"
fi
if [[ ${{ matrix.tag }} == 'devel-service' ]]
then
echo "prereq_image_name="devel"" >> $GITHUB_ENV
compose_command="$compose_command -f docker/docker-compose.devel.yml -f docker/docker-compose.srv.yml"
fi
echo "compose_command=$compose_command" >> $GITHUB_ENV
- name: Download artifact of image
uses: actions/download-artifact@v3
with:
name: sirf-${{ env.prereq_image_name }}
path: /tmp
- name: load prerequisite image
shell: bash -l {0}
run: |
docker load --input /tmp/${{ env.prereq_image_name }}.tar.gz
- name: Build docker image
# Builds docker image from Docker file.
shell: bash -l {0}
run: |
set -ex;
# ${{ env.compose_command }} pull sirf
${{ env.compose_command }} build --pull sirf
- name: Test CIL
shell: bash -l {0}
run: |
set -ex;
docker run --rm -v ./.github/workflows:/gh synerbi/sirf:service /gh/test_cil.sh
- name : docker save image
# https://docs.docker.com/engine/reference/commandline/save/
shell: bash -l {0}
run: |
# first we must delete image that is no longer needed, to save space:
docker rmi synerbi/sirf:${{ env.prereq_image_name }}
# get rid of everything over 2 days old
docker system prune -a --filter "until=2d"
docker image ls
docker save synerbi/sirf:service | gzip > ${{ matrix.tag }}.tar.gz
- name: Upload artifact of image.
uses: actions/[email protected]
with:
name: sirf-${{ matrix.tag }}
path: ${{ matrix.tag }}.tar.gz
# Docker images are not currently uploaded with this action.
# Disable it for now as it would just waste time.
# upload-images:
# runs-on: ubuntu-latest
# needs: [build-service-images, build-service-gpu]
# strategy:
# matrix:
# tag: ['core', 'latest', 'devel', 'service', 'devel-service', 'core-gpu', 'service-gpu']
# steps:
# - uses: actions/checkout@v3
# - name: Install docker and pre-reqs and clean some disk-space
# shell: bash -l {0}
# run: |
# sudo .github/workflows/install_docker.sh
# sudo .github/workflows/GHA_increase_disk_space.sh
# - name: Download artifact of image
# uses: actions/download-artifact@v3
# with:
# name: sirf-${{ matrix.tag }}
# path: /tmp
# - name: load image
# shell: bash -l {0}
# run: |
# docker load --input /tmp/${{ matrix.tag }}.tar.gz
# - name: Upload docker image
# # Builds docker image from Docker file.
# shell: bash -l {0}
# run: |
# # TODO requirement to
# docker image ls
# echo "Here we would upload image with name: ${{ matrix.tag }}"
# TODO: publish to come later