Skip to content

Commit 6f0c42a

Browse files
committed
ci: Add workflow for building ai-runner image
1 parent e9f1bf7 commit 6f0c42a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build Docker image for ai-runner
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
docker:
15+
name: Docker image generation
16+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
17+
permissions:
18+
packages: write
19+
contents: read
20+
runs-on: ubuntu-20.04
21+
steps:
22+
- name: Check out code
23+
uses: actions/[email protected]
24+
with:
25+
fetch-depth: 0
26+
# Check https://github.com/livepeer/go-livepeer/pull/1891
27+
# for ref value discussion
28+
ref: ${{ github.event.pull_request.head.sha }}
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to DockerHub
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
38+
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: |
44+
livepeer/ai-runner
45+
tags: |
46+
type=sha
47+
type=ref,event=pr
48+
type=ref,event=tag
49+
type=sha,format=long
50+
type=ref,event=branch
51+
type=semver,pattern={{version}}
52+
type=semver,pattern={{major}}.{{minor}}
53+
type=semver,pattern={{version}},prefix=v
54+
type=semver,pattern={{major}}.{{minor}},prefix=v
55+
type=raw,value=latest,enable={{is_default_branch}}
56+
type=raw,value=${{ github.event.pull_request.head.ref }}
57+
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }}
58+
59+
- name: Build and push runner docker image
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: "{{defaultContext}}:runner"
63+
platforms: linux/amd64
64+
push: true
65+
tags: ${{ steps.meta.outputs.tags }}
66+
file: "Dockerfile"
67+
labels: ${{ steps.meta.outputs.labels }}
68+
cache-from: type=registry,ref=livepeerci/build:cache
69+
cache-to: type=registry,ref=livepeerci/build:cache,mode=max

0 commit comments

Comments
 (0)