The container build was the one build path that could not learn a version: the build context excludes .git, so it has to be passed in, and nothing passed one -- Compose handed the Dockerfile no build args, so every locally built agent answered "dev" while the daemon reported the tag. The Taskfile now derives the version from git describe once, for both the host binaries and the image, and task image:agent passes it through. docker compose build agent also failed outright: the service named the image by digest, and Compose refuses to tag a digest. The build-only service names it by tag now; what a task container runs is still pinned in the daemon's own [containers] image.
81 lines
3.2 KiB
Docker
81 lines
3.2 KiB
Docker
# archie-agent image: multi-ecosystem dev environment for agent workloads.
|
|
# Pre-installs system tools agents can't install themselves (no apt, no sudo).
|
|
# Language packages are installed at runtime via uv/npm/go.
|
|
#
|
|
# Build: task image:agent (or docker build --build-arg RUNTIME_VERSION=<ver>)
|
|
# A build that names no version stamps none, and the agent reports dev.
|
|
|
|
# ── builder ──
|
|
FROM golang:1.27-trixie AS builder
|
|
ARG RUNTIME_VERSION=dev
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN 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/
|
|
|
|
FROM node:24-trixie-slim AS node
|
|
|
|
# ── runtime ──
|
|
FROM debian:trixie-slim
|
|
ARG RUNTIME_VERSION=dev
|
|
LABEL org.opencontainers.image.version="${RUNTIME_VERSION}"
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
git \
|
|
gh \
|
|
jq \
|
|
ripgrep \
|
|
unzip \
|
|
xz-utils \
|
|
build-essential \
|
|
openssh-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Node.js 24 ──
|
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
|
COPY --from=node /usr/local/include/node /usr/local/include/node
|
|
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
|
|
ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
|
|
npm install -g pnpm typescript tsx esbuild stylelint htmlhint && \
|
|
npm cache clean --force
|
|
|
|
# ── Go ──
|
|
# Reuse the builder's toolchain so the runtime Go can't drift from the one
|
|
# archie-agent was compiled with.
|
|
COPY --from=builder /usr/local/go /usr/local/go
|
|
ENV GOPATH="/go"
|
|
# /go/bin must be on PATH or anything `go install` puts there is unreachable.
|
|
ENV PATH="/usr/local/go/bin:/go/bin:${PATH}"
|
|
|
|
ARG GOLANGCI_LINT_VERSION=2.14.0
|
|
ARG GOFUMPT_VERSION=0.11.0
|
|
ARG BUF_VERSION=1.72.0
|
|
|
|
RUN curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \
|
|
| tar -xz -C /usr/local/bin --strip-components=1 \
|
|
"golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint" && \
|
|
curl -fsSL -o /usr/local/bin/gofumpt \
|
|
"https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VERSION}/gofumpt_v${GOFUMPT_VERSION}_linux_amd64" && \
|
|
curl -fsSL -o /usr/local/bin/buf \
|
|
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" && \
|
|
chmod +x /usr/local/bin/gofumpt /usr/local/bin/buf
|
|
|
|
# ── Python via uv ─────────────────────────────────────────────────────
|
|
ARG PYTHON_VERSION=3.14
|
|
RUN curl -fsSL https://astral.sh/uv/install.sh | sh
|
|
ENV PATH="/root/.local/bin:${PATH}"
|
|
RUN uv python install --default "${PYTHON_VERSION}" && rm -rf /root/.cache/uv
|
|
|
|
COPY --from=builder /usr/local/bin/archie-agent /usr/local/bin/archie-agent
|
|
|
|
# The daemon injects NATS_URL and, when configured, NATS_TOKEN.
|
|
ENTRYPOINT ["archie-agent"]
|