-
Notifications
You must be signed in to change notification settings - Fork 51
148 lines (122 loc) · 4.49 KB
/
build-docker-latest.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
name: Build and publish latest docker images
on:
push:
branches:
- develop
# to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
savant_version: ${{ steps.get-savant-version.outputs.savant_version }}
deepstream_version: ${{ steps.get-deepstream-version.outputs.deepstream_version }}
steps:
- uses: actions/checkout@v3
- id: get-savant-version
run: echo "savant_version=$(cat savant/VERSION | awk -F= '$1=="SAVANT"{print $2}' | sed 's/"//g')" >> $GITHUB_OUTPUT
- id: get-deepstream-version
run: echo "deepstream_version=$(cat savant/VERSION | awk -F= '$1=="DEEPSTREAM"{print $2}' | sed 's/"//g')" >> $GITHUB_OUTPUT
- run: |
echo Savant version: ${{ steps.get-savant-version.outputs.savant_version }}
echo DeepStream version: ${{ steps.get-deepstream-version.outputs.deepstream_version }}
# build deepstream dockers
build-deepstream:
needs: get-version
runs-on: self-hosted
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- docker_file: docker/Dockerfile.deepstream
docker_suffix: deepstream
arch: linux/amd64
- docker_file: docker/Dockerfile.deepstream
docker_suffix: deepstream-l4t
arch: linux/arm64
steps:
- uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
# base image
- name: Build and push savant-deepstream docker image
uses: docker/build-push-action@v4
with:
file: ${{ matrix.docker_file }}
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/savant-${{ matrix.docker_suffix }}:latest
build-args: |
SAVANT_VERSION=${{ needs.get-version.outputs.savant_version }}
DEEPSTREAM_VERSION=${{ needs.get-version.outputs.deepstream_version }}
platforms: ${{ matrix.arch }}
target: base
push: true
# adapter image
- name: Build and push savant-adapters-deepstream docker image
uses: docker/build-push-action@v4
with:
file: ${{ matrix.docker_file }}
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/savant-adapters-${{ matrix.docker_suffix }}:latest
build-args: |
SAVANT_VERSION=${{ needs.get-version.outputs.savant_version }}
DEEPSTREAM_VERSION=${{ needs.get-version.outputs.deepstream_version }}
platforms: ${{ matrix.arch }}
target: adapters
push: true
# build adapter's dockers (except deepstream adapters)
build-adapters:
needs: get-version
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- docker_file: docker/Dockerfile.adapters-gstreamer
docker_image: savant-adapters-gstreamer
arch: linux/amd64
- docker_file: docker/Dockerfile.adapters-gstreamer
docker_image: savant-adapters-gstreamer-l4t
arch: linux/arm64
- docker_file: docker/Dockerfile.adapters-py
docker_image: savant-adapters-py
arch: linux/amd64
- docker_file: docker/Dockerfile.adapters-py
docker_image: savant-adapters-py-l4t
arch: linux/arm64
steps:
- uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
- name: Build and push docker image
uses: docker/build-push-action@v4
with:
file: ${{ matrix.docker_file }}
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.docker_image }}:latest
platforms: ${{ matrix.arch }}
push: true