Files
zeekayandHanzo Dev 1ac4c806b2 Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 19:23:15 -07:00

55 lines
2.6 KiB
Docker

# syntax=docker/dockerfile:1
# ---------------------------------------------------------------------------
# maker — the V4 CLOB liquidity seeder (CPU, linux/amd64) — ghcr.io/luxfi/maker
#
# A long-running client (NOT a server): it creates the canonical custody markets
# (LUX/LUSD, LUX/LETH) on the native D-Chain CLOB and maintains a 2-sided book
# around a reference mid every refresh interval, so the exchange Trade page shows
# a live orderbook. Seeds over luxd's HTTP router at <DEX_HTTP_URL>/dex/<method>
# (the native in-luxd D-Chain VM; see dex/pkg/dchain/ingest.go).
#
# Config is 12-factor (env): DEX_HTTP_URL (REQUIRED to seed), MAKER_USER,
# MAKER_SPREAD_BPS, MAKER_LEVELS, MAKER_INTERVAL, ... (see cmd/maker/main.go).
# Without DEX_HTTP_URL the binary runs the offline stub-aggregator instead of
# seeding — k8s/compose always set it.
#
# CGO_ENABLED=0 → a static binary on luxfi/crypto's pure-Go path (no CUDA/MLX,
# runs on any amd64). Mirrors the sibling ghcr.io/luxfi/dex image's build.
# ---------------------------------------------------------------------------
ARG GO_VERSION=1.27.1
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
git ca-certificates && rm -rf /var/lib/apt/lists/*
# luxfi modules (geth/crypto/rpc) are private: resolve via the gh_token BuildKit
# secret the shared hanzoai/.github docker-build.yml passes, and skip the public
# sumdb for luxfi paths (go.sum in the build context carries the hashes).
ENV GOPRIVATE=github.com/lux-private/*
ENV GOFLAGS=-mod=mod
ENV GOTOOLCHAIN=auto
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=secret,id=gh_token,required=false \
if [ -s /run/secrets/gh_token ]; then \
git config --global url."https://x-access-token:$(cat /run/secrets/gh_token)@github.com/".insteadOf "https://github.com/"; \
fi && \
go mod download
COPY . .
RUN --mount=type=secret,id=gh_token,required=false \
if [ -s /run/secrets/gh_token ]; then \
git config --global url."https://x-access-token:$(cat /run/secrets/gh_token)@github.com/".insteadOf "https://github.com/"; \
fi && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags="-s -w" -o /out/maker ./cmd/maker
FROM debian:12-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates && rm -rf /var/lib/apt/lists/* \
&& groupadd -g 1000 maker && useradd -u 1000 -g maker -m -s /usr/sbin/nologin maker
COPY --from=builder /out/maker /usr/local/bin/maker
USER maker
ENTRYPOINT ["/usr/local/bin/maker"]