Try using ko to build images

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2025-03-19 08:51:09 -04:00
parent 1a13292c2d
commit 1efcb88261
No known key found for this signature in database
6 changed files with 166 additions and 11 deletions

View file

@ -8,6 +8,9 @@ on:
pull_request:
branches: [ "main" ]
env:
DOCKER_METADATA_SET_OUTPUT_ENV: "true"
permissions:
contents: read
packages: write
@ -20,6 +23,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@ -27,6 +33,12 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/setup-go@v5
with:
go-version: '1.24.x'
- uses: ko-build/setup-ko@v0.8
- name: Log into registry
uses: docker/login-action@v3
with:
@ -42,16 +54,8 @@ jobs:
- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
context: .
cache-to: type=gha
cache-from: type=gha
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64/v8,linux/amd64
sbom: true
push: true
run: |
go run ./cmd/containerbuild --docker-repo ghcr.io/techarohq/anubis --slog-level debug
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2