-
Notifications
You must be signed in to change notification settings - Fork 3
204 lines (198 loc) · 6.61 KB
/
build-push.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
name: build-push
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
env:
## Application versions used for the main release
## note: nightly builds will always use the master/main branch
JUGGLER_VERSION: "v9.4.0"
EICRECON_VERSION: "v1.2.1"
## Dockerhub registry
DH_REGISTRY: docker.io
DH_REGISTRY_USER: eicweb
DH_PUSH: 0
## GitHub registry
GH_REGISTRY: ghcr.io
GH_REGISTRY_USER: eic
GH_PUSH: 0
jobs:
base:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- BASE_IMAGE: debian:testing-20220822-slim
BUILD_IMAGE: debian_testing_base
PLATFORM: linux/amd64,linux/arm64/v8
- BASE_IMAGE: ubuntu:20.04
BUILD_IMAGE: ubuntu_base
PLATFORM: linux/amd64,linux/arm64/v8
# - BASE_IMAGE: intel/oneapi-hpckit:2022.3.0-devel-ubuntu20.04
# BUILD_IMAGE: oneapi_base
# PLATFORM: linux/amd64
# - BASE_IMAGE: nvidia/cuda:11.8.0-devel-ubuntu20.04
# BUILD_IMAGE: cuda_base
# PLATFORM: linux/amd64
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ matrix.BUILD_IMAGE }}-${{ github.sha }}
restore-keys: |
${{ matrix.BUILD_IMAGE }}-
-
name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ env.DH_PUSH == '1' }}
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ env.DH_REGISTRY_USER }}
password: ${{ secrets.DH_EICWEB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: ${{ env.GH_PUSH == '1' }}
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ env.GH_REGISTRY_USER }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
file: containers/debian/base.Dockerfile
context: containers/debian
platforms: ${{ matrix.PLATFORM }}
push: false
tags: |
eicweb/${{ matrix.BUILD_IMAGE }}:test
ghcr.io/eic/${{ matrix.BUILD_IMAGE }}:test
build-args: |
BASE_IMAGE=${{ matrix.BASE_IMAGE }}
BUILD_IMAGE=${{ matrix.BUILD_IMAGE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
-
name: Move cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
dev:
runs-on: ubuntu-latest
needs: base
strategy:
matrix:
include:
- BASE_IMAGE: debian_testing_base
BUILD_IMAGE: jug_dev
PLATFORM: linux/amd64,linux/arm64/v8
# - BASE_IMAGE: oneapi_base
# BUILD_IMAGE: jug_dev_oneapi
# PLATFORM: linux/amd64
# - BASE_IMAGE: cuda_base_new
# BUILD_IMAGE: jug_dev_cuda
# PLATFORM: linux/amd64
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Load spack version and cherry-picks
id: spack
shell: bash
run: |
source spack.sh
echo "orgrepo=${SPACK_ORGREPO}" | tee -a $GITHUB_OUTPUT
echo "version=${SPACK_VERSION}" | tee -a $GITHUB_OUTPUT
echo "cherrypicks=${SPACK_CHERRYPICKS//$'\n'/ }" | tee -a $GITHUB_OUTPUT
-
name: Load eic-spack version and cherry-picks
id: eicspack
run: |
source eicspack.sh
echo "orgrepo=${EICSPACK_ORGREPO}" | tee -a $GITHUB_OUTPUT
echo "version=${EICSPACK_VERSION}" | tee -a $GITHUB_OUTPUT
echo "cherrypicks=${EICSPACK_CHERRYPICKS//$'\n'/ }" | tee -a $GITHUB_OUTPUT
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ matrix.BUILD_IMAGE }}-${{ github.sha }}
restore-keys: |
${{ matrix.BUILD_IMAGE }}-
-
name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ env.DH_PUSH == '1' }}
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ env.DH_REGISTRY_USER }}
password: ${{ secrets.DH_EICWEB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: ${{ env.GH_PUSH == '1' }}
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ env.GH_REGISTRY_USER }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
file: containers/jug/dev.Dockerfile
context: containers/jug
platforms: ${{ matrix.PLATFORM }}
push: false
tags: |
eicweb/${{ matrix.BUILD_IMAGE }}:test
ghcr.io/eic/${{ matrix.BUILD_IMAGE }}:test
build-args: |
DOCKER_REGISTRY=${{ env.GH_REGISTRY }}/${{ env.GH_REGISTRY_USER }}/
BASE_IMAGE=${{ matrix.BASE_IMAGE }}
BUILD_IMAGE=${{ matrix.BUILD_IMAGE }}
SPACK_ORGREPO=${{ steps.spack.outputs.orgrepo }}
SPACK_VERSION=${{ steps.spack.outputs.version }}
SPACK_CHERRYPICKS=${{ steps.spack.outputs.cherrypicks }}
EICSPACK_ORGREPO=${{ steps.eicspack.outputs.orgrepo }}
EICSPACK_VERSION=${{ steps.eicspack.outputs.version }}
EICSPACK_CHERRYPICKS=${{ steps.eicspack.outputs.cherrypicks }}
build-contexts: |
spack=.
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
-
name: Move cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache