Skip to content

Commit 0fb0ba4

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

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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: Log in to the Container registry
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ github.token }}
45+
46+
- name: Extract metadata (tags, labels) for Docker
47+
id: meta
48+
uses: docker/metadata-action@v5
49+
with:
50+
images: |
51+
livepeer/ai-runner
52+
ghcr.io/ai-runner
53+
tags: |
54+
type=sha
55+
type=ref,event=pr
56+
type=ref,event=tag
57+
type=sha,format=long
58+
type=ref,event=branch
59+
type=semver,pattern={{version}}
60+
type=semver,pattern={{major}}.{{minor}}
61+
type=semver,pattern={{version}},prefix=v
62+
type=semver,pattern={{major}}.{{minor}},prefix=v
63+
type=raw,value=latest,enable={{is_default_branch}}
64+
type=raw,value=${{ github.event.pull_request.head.ref }}
65+
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }}
66+
67+
- name: Build and push runner docker image
68+
uses: docker/build-push-action@v5
69+
with:
70+
context: .
71+
platforms: linux/amd64
72+
push: true
73+
tags: ${{ steps.meta.outputs.tags }}
74+
file: "Dockerfile"
75+
labels: ${{ steps.meta.outputs.labels }}
76+
cache-from: type=registry,ref=livepeerci/build:cache
77+
cache-to: type=registry,ref=livepeerci/build:cache,mode=max

0 commit comments

Comments
 (0)