build: add task dist, build the dashboard once, cache Go in image builds

`task dist` builds the binaries release.json names into dist/ with the
compiler flags `build` uses, so after the gate has built bin/ it only links.
`build` is now static (CGO_ENABLED=0), like what ships.

`ui` runs once per task invocation: check built the dashboard, then build's
dependency built it again under the Go steps that embed it.

Both Dockerfiles compile with cache mounts for Go's module and build caches.
This commit is contained in:
sam committed 2026-11-10 10:56:12 +00:00
1 parent c3e64e5485
commit b509397e8d
5 files changed
+49 -6

No files matched your search

+6 -2
View File
@@ -10,9 +10,13 @@ FROM golang:1.27-trixie AS builder
ARG RUNTIME_VERSION=dev
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
# Cache mounts keep modules and compiled packages on the build daemon; without
# them COPY . . makes every commit a cold compile.
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
RUN CGO_ENABLED=0 go build \
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build \
-ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
-o /usr/local/bin/archie-agent ./cmd/archie-agent/