Compare commits

...
2 Commits
Author SHA1 Message Date
aneurinandClaude Sonnet 5 ad4fc7dd7d name the build artifact with its architecture
Build / build-image (push) Skipped
Build / build-binary (push) Failing after 59s
Rename the CI binary and its artifact to zampler-amd64, and make the
Dockerfile arch-agnostic via ARG TARGETARCH / COPY zampler-$TARGETARCH.
Keeps the pipeline single-arch for now but makes adding an arm64 leg a
smaller change later.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-06 17:07:20 +01:00
aneurinandClaude Sonnet 5 298d2f248e split build workflow into binary and image jobs
build-binary compiles the frontend and Go binary (with the module and
build caches) and uploads it as an artifact; build-image downloads the
artifact and builds/pushes the Docker image from it.

The executable bit is restored after download since upload-artifact
does not preserve it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-06 16:25:09 +01:00
3 changed files with 40 additions and 9 deletions
+2 -2
View File
@@ -1,3 +1,3 @@
# Build context only needs the prebuilt ./zampler binary and the Dockerfile.
# Build context only needs the prebuilt zampler-<arch> binary and the Dockerfile.
*
!zampler
!zampler-*
+31 -4
View File
@@ -6,7 +6,7 @@ on:
workflow_dispatch:
jobs:
build-and-push:
build-binary:
runs-on: ubuntu-latest
container:
image: golang:1.26-alpine
@@ -14,7 +14,7 @@ jobs:
CGO_ENABLED: "0"
steps:
- name: Install toolchain deps
run: apk add --no-cache nodejs npm docker-cli git tar
run: apk add --no-cache nodejs npm git tar
- uses: actions/checkout@v4
@@ -43,7 +43,34 @@ jobs:
npx vite build --outDir ../internal/server/static --emptyOutDir
- name: Build binary
run: go build -ldflags="-s -w" -o zampler .
run: go build -ldflags="-s -w" -o zampler-amd64 .
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: zampler-amd64
path: zampler-amd64
if-no-files-found: error
retention-days: 1
build-image:
runs-on: ubuntu-latest
needs: build-binary
container:
image: docker:cli
steps:
- name: Install action deps
run: apk add --no-cache nodejs
- uses: actions/checkout@v4
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: zampler-amd64
- name: Restore executable bit
run: chmod +x zampler-amd64
- name: Log in to the container registry
env:
@@ -61,5 +88,5 @@ jobs:
- name: Build and push "latest"
run: |
IMAGE="code.aneur.in/${{ gitea.repository }}:latest"
docker build -t "$IMAGE" .
docker build --build-arg TARGETARCH=amd64 -t "$IMAGE" .
docker push "$IMAGE"
+7 -3
View File
@@ -1,12 +1,16 @@
# The zampler binary is built in CI (.gitea/workflows/build.yml) so the compile
# can use a persistent Go module + build cache. This image is just the runtime
# wrapper around the prebuilt static binary.
# wrapper around the prebuilt static binary. The build context must contain a
# zampler-<arch> binary; TARGETARCH is set automatically by BuildKit (or pass
# --build-arg TARGETARCH=... on a legacy builder).
#
# For a local build: `go build -o zampler .` first, then `docker build .`.
# For a local build:
# go build -o zampler-$(go env GOARCH) . && docker build .
FROM alpine:3.24
COPY zampler /usr/local/bin/zampler
ARG TARGETARCH
COPY zampler-$TARGETARCH /usr/local/bin/zampler
ENTRYPOINT ["zampler"]
CMD ["-s", "/db/zampler.sqlite3", "/data"]