-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (50 loc) · 1.55 KB
/
container-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
name: Build and Push Containers
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/container-build.yml'
permissions:
contents: read
packages: write
jobs:
build-containers:
runs-on: ubuntu-latest
env:
VERSION: latest
BASE_REPO: ghcr.io/carverauto/serviceradar
steps:
- uses: actions/checkout@v4
- name: Extract short SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Setup ko
uses: ko-build/[email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push container images
run: |
SHA_TAG=sha-${{ steps.vars.outputs.sha_short }}
echo "Pushing to ${{ env.BASE_REPO }}/serviceradar-agent"
cd cmd/agent
KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-agent GOFLAGS="-tags=containers" ko build \
--platform=linux/amd64 \
--tags=${SHA_TAG},latest \
--bare --verbose .
cd ../..
# Uncomment after agent works
# cd cmd/cloud
# KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-cloud CGO_ENABLED=1 GOFLAGS="-tags=containers" ko build ...
# (add other components)