-
Notifications
You must be signed in to change notification settings - Fork 32
72 lines (60 loc) · 1.85 KB
/
build.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
name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1,4' # midnight US/Pacific on Sundays and Wednesdays
pull_request:
branches:
- main
- "release-[0-9].[0-9]+"
paths-ignore:
- "**.md"
push:
branches:
- main
- "release-[0-9].[0-9]+"
tags:
- "v*"
paths-ignore:
- "**.md"
env:
IMAGE_NAME: "kserve/rest-proxy"
jobs:
build:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Export docker build args
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Generate PR tag from github.ref == "refs/pull/123/merge"
[ "$VERSION" == "merge" ] && VERSION=$(echo "${{ github.ref }}" | sed -e 's,refs/pull/\(.*\)/merge,pr-\1,')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV
# print env vars for debugging
cat "$GITHUB_ENV"
- name: Build and push runtime image
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
context: .
target: runtime
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max