-
Notifications
You must be signed in to change notification settings - Fork 10
53 lines (46 loc) · 1.57 KB
/
build-containers.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
53
name: Build and Publish Node Images (CUDA & Standard)
on:
push:
branches:
- main
- helm
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [standard, cuda]
permissions:
contents: read
packages: write
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
docker-images: false
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Version from Cargo.toml
run: echo "VERSION=${{ github.head_ref || github.ref_name }}-$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "bonsol-node") | .version')" >> $GITHUB_ENV
working-directory: ./node
- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: true
file: Dockerfile.${{ matrix.flavor }}
tags: |
ghcr.io/${{ github.repository_owner }}/bonsol-node:${{ matrix.flavor }}-${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/bonsol-node:${{ matrix.flavor }}-${{ github.sha }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max