Compare commits
2
Commits
dd6bb1a547
...
ad4fc7dd7d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad4fc7dd7d | ||
|
|
298d2f248e |
+2
-2
@@ -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-*
|
||||
|
||||
@@ -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
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user