Files
wehub-resource-sync 26382a7ac6
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
JetBrains Plugin / Actionlint (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (rust) (push) Waiting to run
JetBrains Plugin / Validation (push) Waiting to run
JetBrains Plugin / Build (push) Waiting to run
JetBrains Plugin / Test (push) Blocked by required conditions
Security Check / Security Scan (push) Waiting to run
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

52 lines
2.0 KiB
Docker

# lean-ctx gateway-server image (enterprise#10/#30).
#
# The artifact the deploy template (root/lean-ctx-deploy Helm chart) runs:
# the OSS lean-ctx binary built with the `gateway-server` feature — hardened
# proxy + Postgres usage_events store + admin usage API + /metrics. No
# commercial code in this image (Local-Free Invariant: self-hosting the
# gateway is free; the managed control plane lives in lean-ctx-enterprise).
#
# Build (from the repo root):
# docker build -f docker/Dockerfile.gateway -t <registry>/lean-ctx/gateway-server:<tag> .
FROM rust:1-bookworm AS builder
# Memory-fit defaults for Docker Desktop's 8 GiB VM: the workspace profile
# (fat LTO + codegen-units=1) needs >8 GiB in the single LTO link step and
# dies with ResourceExhausted. Thin LTO + 4 jobs builds comfortably; the
# runtime difference is irrelevant for a network-bound proxy. CI runners
# with ≥16 GiB restore the fat profile:
# docker build --build-arg LTO=fat --build-arg CODEGEN_UNITS=1 --build-arg CARGO_JOBS=8 …
ARG CARGO_JOBS=4
ARG LTO=thin
ARG CODEGEN_UNITS=16
ENV CARGO_PROFILE_RELEASE_LTO=${LTO} \
CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${CODEGEN_UNITS}
WORKDIR /app
# rust/ carries all compile-time data (pricing tables, compliance mappings)
# that include_str! needs — one COPY covers the whole build context.
COPY rust ./rust
RUN cd rust && cargo build --release --features gateway-server --jobs "${CARGO_JOBS}"
FROM debian:bookworm-slim
# ca-certificates: outbound TLS to the LLM providers.
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --uid 10001 --create-home --home-dir /var/lib/lean-ctx leanctx
COPY --from=builder /app/rust/target/release/lean-ctx /usr/local/bin/lean-ctx
USER 10001
ENV LEAN_CTX_CONFIG_DIR=/etc/lean-ctx
ENV LEAN_CTX_DATA_DIR=/var/lib/lean-ctx
# Proxy surface + admin listener (admin defaults to proxy port + 1).
EXPOSE 8484 8485
ENTRYPOINT ["lean-ctx"]
CMD ["gateway", "serve", "--port=8484", "--admin-port=8485"]