Adds the admin module: env config with fail-fast validation, two MongoDB connections (its own vantage_admin database plus a narrow path into the control plane), the boot sequence and the image. Config refuses to start without a signing key, and both Mongo URIs must name their database inline -- admin talks to two databases, so a bare MONGO_DB would be ambiguous about which. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
818 B
Docker
31 lines
818 B
Docker
# Context is the repository root; admin depends on the shared module.
|
|
FROM golang:1.26-alpine AS builder
|
|
|
|
WORKDIR /src
|
|
|
|
COPY shared/go.mod shared/go.sum ./shared/
|
|
COPY admin/go.mod admin/go.sum ./admin/
|
|
RUN cd admin && go mod download
|
|
|
|
COPY shared/ ./shared/
|
|
COPY admin/ ./admin/
|
|
|
|
RUN cd admin && CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/admin ./cmd
|
|
RUN cd admin && CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/adminctl ./cmd/adminctl
|
|
|
|
FROM alpine:3.20 AS runner
|
|
|
|
RUN apk add --no-cache ca-certificates && \
|
|
addgroup --system --gid 1001 admin && \
|
|
adduser --system --uid 1001 --ingroup admin admin
|
|
|
|
COPY --from=builder /out/admin /usr/local/bin/admin
|
|
COPY --from=builder /out/adminctl /usr/local/bin/adminctl
|
|
|
|
USER admin
|
|
|
|
EXPOSE 8083
|
|
ENV PORT=8083
|
|
|
|
CMD ["/usr/local/bin/admin"]
|