-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.45 KB
/
build-push-gdrdrv-dp.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
name: Build and push gdrdrv device plugin images
on:
push:
branches:
- main
paths:
- cmd/ocp-gdrdrv-device-plugin/**
- ./go.mod
- ./go.sum
workflow_dispatch:
env:
VERSION: '0.0.1'
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build-push-gdrdrv-dp:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ghcr.io/foundation-model-stack/ocp-gdrdrv-device-plugin
CGO_ENABLED: 0
GOOS: linux
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.21'
- name: Tidy
run: |
go mod tidy
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Build
run: |
go build -v -a -ldflags '-extldflags "-static"' -gcflags="all=-N -l" -o ./bin/ocp-gdrdrv-device-plugin ./cmd/ocp-gdrdrv-device-plugin/
- name: Build and push gdrdrv device plugin
uses: docker/build-push-action@v2
with:
context: ./bin/
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ github.sha }}-${{ github.run_number }}
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:v${{ env.VERSION }}
file: ./cmd/ocp-gdrdrv-device-plugin/Dockerfile