`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.
41 lines
1.5 KiB
Docker
41 lines
1.5 KiB
Docker
# archied — the archie daemon
|
|
# Run via docker compose alongside NATS.
|
|
|
|
FROM node:24-trixie-slim AS dashboard
|
|
WORKDIR /src/ui
|
|
RUN corepack enable
|
|
COPY ui/package.json ui/pnpm-lock.yaml ui/pnpm-workspace.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY ui/ ./
|
|
RUN pnpm run build
|
|
|
|
FROM golang:1.27-trixie AS builder
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
# 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 . .
|
|
COPY --from=dashboard /src/ui/dist ./ui/dist
|
|
ARG GATEWAY_VERSION=dev
|
|
ARG RUNTIME_VERSION=dev
|
|
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/buildinfo.Version=${GATEWAY_VERSION} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
|
|
-o /usr/local/bin/archied ./cmd/archied/
|
|
|
|
FROM debian:trixie-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates git && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
COPY --from=builder /usr/local/bin/archied /usr/local/bin/archied
|
|
ARG GATEWAY_VERSION=dev
|
|
ARG RUNTIME_VERSION=dev
|
|
LABEL org.opencontainers.image.version="${GATEWAY_VERSION}"
|
|
LABEL cloud.catlow.archie.runtime-version="${RUNTIME_VERSION}"
|
|
|
|
COPY CHANGELOG.md /usr/share/archie/CHANGELOG.md
|
|
|
|
ENTRYPOINT ["archied"]
|