-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (83 loc) · 2.24 KB
/
docker-build.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
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
name: Build Docker images
on:
push:
branches:
- main
paths:
- 'base_images/**'
- '!base_images/.gitignore'
- '!base_images/README*'
pull_request:
paths:
- 'base_images/**'
- '!base_images/.gitignore'
- '!base_images/README*'
schedule:
# build daily
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
# phase 1
list:
runs-on: ubuntu-latest
outputs:
component_matrix: ${{ steps.ns_list.outputs.output_matrix }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
base_images
sparse-checkout-cone-mode: false
- name: setup base images directory
run: |
mv base_images/* .
rm -rf base_images
- uses: viash-io/viash-actions/setup@v6
- id: ns_list
uses: viash-io/viash-actions/ns-list@v6
with:
engine: docker
format: json
# phase 2
build:
needs: list
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
component: ${{ fromJson(needs.list.outputs.component_matrix) }}
steps:
# Remove unnecessary files to free up space.
- uses: data-intuitive/reclaim-the-bytes@v2
- uses: actions/checkout@v4
with:
sparse-checkout: |
base_images
sparse-checkout-cone-mode: false
- name: setup base images directory
run: |
mv base_images/* .
rm -rf base_images
- uses: viash-io/viash-actions/setup@v6
- name: Login to container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build image
run: |
viash run ${{matrix.component.config}} -- \
---engine docker \
---setup build \
---verbose
# only push the image if event is not a pull request
- name: Push image
if: github.event_name != 'pull_request'
run: |
viash run ${{matrix.component.config}} -- \
---engine docker \
---setup push \
---verbose