Skip to content

Commit e514237

Browse files
authored
Containerize seiload and publish to GHCR (#6)
Containerize the `seiload` CLI and add GitHub Actions workflow to build the container in PRs and publish on merges to `main`, along with adhoc workflow dispatch by commit SHA for experimental work/debugging on non-main branches.
1 parent cad37bf commit e514237

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Container
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
workflow_dispatch:
11+
inputs:
12+
sha:
13+
description: 'Commit SHA to publish'
14+
required: true
15+
16+
jobs:
17+
publish:
18+
name: Publish
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ needs.prepare-checkout.outputs.ref }}
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ github.token }}
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ghcr.io/${{ github.repository }}
41+
tags: |
42+
type=semver,pattern={{raw}}
43+
type=ref,event=branch
44+
type=sha,format=long
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max
51+
platforms: linux/amd64
52+
push: ${{ github.event_name != 'pull_request' }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.24.5-bullseye AS build
2+
3+
WORKDIR /go/src/sei-load
4+
5+
COPY go.mod go.sum ./
6+
RUN go mod download
7+
8+
COPY . .
9+
RUN go build -o /go/bin/seiload ./
10+
11+
FROM gcr.io/distroless/base
12+
COPY --from=build /go/bin/seiload /usr/bin/
13+
14+
ENTRYPOINT ["/usr/bin/seiload"]

0 commit comments

Comments
 (0)