~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
58 lines · 2.1 KB Raw History
# syntax=docker/dockerfile:1

# The server as a container image: `hud serve`, listening on every address
# of the container's network, its lexicon cache on the volume /data, run as
# a user of its own. HUD_PUBLIC_URL, the origin it is reached at, is the
# operator's: blob URLs and the view's CSP name it.
#
#   docker build -t hud .
#   docker run -p 8787:8787 -v hud-cache:/data -e HUD_PUBLIC_URL=https://hud.example hud

# The view, which hud-server embeds as it compiles.
FROM node:24.22.1-trixie-slim AS web
WORKDIR /src/web
COPY web/package.json web/package-lock.json ./
COPY web/renderer/package.json renderer/
COPY web/shared/package.json shared/
COPY web/shell/package.json shell/
RUN npm ci --no-audit --no-fund
COPY web/ ./
# `npm run build` makes the workspace's lexicon types from ../schemas first.
COPY schemas ../schemas
RUN npm run build

FROM rust:1.98-trixie AS build
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY .cargo .cargo
COPY crates crates
COPY lexicons lexicons
COPY schemas schemas
COPY views views
COPY themes themes
COPY --from=web /src/web/dist web/dist
# The cache mounts keep the registry and the build between builds on the
# same machine, as the deploy's on hud.place's box (.knotless/workflows/
# deploy.yml), so a build compiles HUD's crates and not their dependencies.
# CARGO_BUILD_JOBS is how many jobs cargo runs, where the build shares a
# machine that serves something else; unset, every core.
ARG CARGO_BUILD_JOBS
RUN --mount=type=cache,target=/usr/local/cargo/registry \
    --mount=type=cache,target=/src/target \
    cargo build --release --locked -p hud \
    && cp target/release/hud /usr/local/bin/hud

FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
  && rm -rf /var/lib/apt/lists/* \
  && groupadd --system --gid 10001 hud \
  && useradd --system --uid 10001 --gid 10001 --home-dir /data --shell /usr/sbin/nologin hud \
  && mkdir /data && chown hud:hud /data
COPY --from=build /usr/local/bin/hud /usr/local/bin/hud
USER hud
# `::` takes IPv4 too on Linux.
ENV HUD_PORT=8787 HUD_BIND=:: HUD_CACHE_DIR=/data
VOLUME /data
EXPOSE 8787
ENTRYPOINT ["hud"]
CMD ["serve"]