-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.26 KB
/
docker-builds.yaml
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
name: build containers metrics-operator
on:
pull_request: []
push:
branches:
- main
jobs:
build-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [["sysstat", "ghcr.io/converged-computing/metric-sysstat:latest"],
["osu-benchmark", "ghcr.io/converged-computing/metric-osu-benchmark:latest"]]
steps:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Layers (if exist)
env:
container: ${{ matrix.test[1] }}
run: docker pull ${container} || echo "${container} not pushed yet"
- name: Build Container
env:
context: ${{ matrix.test[0] }}
container: ${{ matrix.test[1] }}
run: |
cd ${context}
docker build -t ${container} .
- name: Deploy Container
if: (github.event_name != 'pull_request')
env:
container: ${{ matrix.test[1] }}
run: docker push ${container}