-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f30ce61
commit daee2df
Showing
5 changed files
with
224 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# .github/workflows/container-build.yml | ||
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 | ||
KO_DOCKER_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: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: 'web/package-lock.json' | ||
- name: Setup ko | ||
uses: ko-build/[email protected] | ||
- name: Build web UI | ||
run: ./scripts/build-web.sh | ||
- name: Move web artifacts | ||
run: | | ||
mkdir -p pkg/cloud/api/web/ | ||
cp -r web/dist pkg/cloud/api/web/ | ||
mkdir -p cmd/cloud/.kodata | ||
cp -r web/dist cmd/cloud/.kodata/web | ||
- 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: | | ||
# Set up ko repository | ||
export KO_DOCKER_REPO=ghcr.io/carverauto/serviceradar | ||
# Build and push container images for all components | ||
GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--base-import-paths \ | ||
--tags=sha-${{ steps.vars.outputs.sha_short }},latest \ | ||
--bare \ | ||
--image-refs=image-refs.txt \ | ||
./cmd/agent \ | ||
./cmd/poller \ | ||
./cmd/cloud \ | ||
./cmd/checkers/dusk \ | ||
./cmd/checkers/snmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,9 @@ on: | |
types: [created] | ||
permissions: | ||
contents: write | ||
packages: write | ||
jobs: | ||
build: | ||
build-packages: | ||
runs-on: ubuntu-latest | ||
env: | ||
VERSION: ${{ github.ref_name }} | ||
|
@@ -35,3 +36,55 @@ jobs: | |
files: ./release-artifacts/*.deb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-containers: | ||
runs-on: ubuntu-latest | ||
needs: build-packages | ||
env: | ||
VERSION: ${{ github.ref_name }} | ||
KO_DOCKER_REPO: ghcr.io/carverauto/serviceradar | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.24' | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: 'web/package-lock.json' | ||
- name: Setup ko | ||
uses: ko-build/[email protected] | ||
- name: Build web UI | ||
run: ./scripts/build-web.sh | ||
- name: Move web artifacts | ||
run: | | ||
mkdir -p pkg/cloud/api/web/ | ||
cp -r web/dist pkg/cloud/api/web/ | ||
mkdir -p cmd/cloud/.kodata | ||
cp -r web/dist cmd/cloud/.kodata/web | ||
- 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: | | ||
# Set up ko repository | ||
export KO_DOCKER_REPO=ghcr.io/carverauto/serviceradar | ||
# Build and push container images for all components | ||
GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--base-import-paths \ | ||
--tags=${VERSION},latest \ | ||
--bare \ | ||
--image-refs=image-refs.txt \ | ||
./cmd/agent \ | ||
./cmd/poller \ | ||
./cmd/cloud \ | ||
./cmd/checkers/dusk \ | ||
./cmd/checkers/snmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build !containers | ||
// +build !containers | ||
|
||
// Package web pkg/cloud/api/web/noncontainer.go | ||
package web | ||
|
||
// GetStaticFilesPath returns the path to static files in non-container mode. | ||
func GetStaticFilesPath() string { | ||
// Default path for deb package installation | ||
return "/usr/local/share/serviceradar-cloud/web/dist" | ||
} |