Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: goreleaser

on:
on:
push:
tags:
- "*"

permissions:
contents: write
packages: write

jobs:
goreleaser:
Expand All @@ -16,16 +17,29 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly' or a semver version like 'v2.0.0'
version: "~> v2"
args: release --clean
workdir: .
Expand Down
37 changes: 37 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,45 @@ builds:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
main: ./cmd/kai

dockers:
- image_templates:
- "ghcr.io/basebandit/kai:{{ .Tag }}-amd64"
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
goarch: amd64

- image_templates:
- "ghcr.io/basebandit/kai:{{ .Tag }}-arm64"
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
goarch: arm64

docker_manifests:
- name_template: "ghcr.io/basebandit/kai:{{ .Tag }}"
image_templates:
- "ghcr.io/basebandit/kai:{{ .Tag }}-amd64"
- "ghcr.io/basebandit/kai:{{ .Tag }}-arm64"

- name_template: "ghcr.io/basebandit/kai:latest"
image_templates:
- "ghcr.io/basebandit/kai:{{ .Tag }}-amd64"
- "ghcr.io/basebandit/kai:{{ .Tag }}-arm64"

archives:
- formats: tar.gz
name_template: >-
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build stage
FROM golang:1.24-alpine AS builder

WORKDIR /app

# Install git for go mod download
RUN apk add --no-cache git

# Download dependencies first (better caching)
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o kai ./cmd/kai

# Runtime stage
FROM alpine:3.19

RUN apk --no-cache add ca-certificates

COPY --from=builder /app/kai /usr/local/bin/kai

ENTRYPOINT ["kai"]
7 changes: 7 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine:3.19

RUN apk --no-cache add ca-certificates

COPY kai /usr/local/bin/kai

ENTRYPOINT ["kai"]
Loading
Loading