Skip to content

The only tool you need to know what is happening and how to fix it.

feat: support for BUILDPLATFORM (#223)

narrow-adventure2d81f7661744
diff --git a/.github/workflows/release-traceway.yml b/.github/workflows/release-traceway.yml
index 7aa13603..cc081070 100644
--- a/.github/workflows/release-traceway.yml
+++ b/.github/workflows/release-traceway.yml
@@ -175,6 +175,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -217,6 +220,7 @@ jobs:
with:
context: .
file: ./Dockerfile.sqlite
+ platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/traceway:v${{ inputs.version }}-sqlite
diff --git a/Dockerfile.sqlite b/Dockerfile.sqlite
index 7de6451f..3668fc83 100644
--- a/Dockerfile.sqlite
+++ b/Dockerfile.sqlite
@@ -7,7 +7,7 @@
# ==============================================================================
# Stage 1: Build Frontend
# ==============================================================================
-FROM node:22-alpine AS frontend-builder
+FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend-builder
WORKDIR /app/frontend
@@ -23,7 +23,7 @@ RUN npm run build
# ==============================================================================
# Stage 2: Build Backend with embedded frontend (no pgch tag = SQLite mode)
# ==============================================================================
-FROM golang:1.25-alpine AS backend-builder
+FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS backend-builder
WORKDIR /app/backend
@@ -39,7 +39,9 @@ RUN go mod download
# Build WITHOUT the pgch tag so the SQLite codepath in app/db/db_sqlite.go
# is selected. modernc.org/sqlite is pure Go, so CGO_ENABLED=0 is fine.
-RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /traceway ./cmd/traceway
+ARG TARGETOS
+ARG TARGETARCH
+RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /traceway ./cmd/traceway
# ==============================================================================
# Stage 3: Minimal runtime image