docker/Containerfile 3.7 KiB 67 lines Raw
1 # syntax=docker/dockerfile:12 # Builds the engine workspace with the pinned toolchain. Every base is3 # digest-pinned. `docker/control.lock` records the same three references, and4 # 08_image compares the image labels with it. Bundle images are built5 # separately from each bundle's own Dockerfile; this control image contains no6 # plugin binary and no engine library.7 ARG RUST_IMAGE=rust:1.99.1-bookworm@sha256:e6f2cff35d0f309acf8433b4f05878ed77092602c5065cc81801177da0bb3a9c8 ARG DEBIAN_IMAGE=debian:bookworm-slim@sha256:734a72b3d6142a71993b4bc580ca01d8ca687f77a2c422d96a961d3376b179bc9 ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.13.4@sha256:9f130421e930bfbdc563c00740466603f8723158e90297d07957c2294640262b10 FROM ${RUST_IMAGE} AS build11 WORKDIR /src12 # The manifests and the lock file decide the dependency graph. The registry13 # cache and the target cache are BuildKit mounts: a source change rebuilds the14 # layer, but downloaded crates and unchanged compiled dependencies survive it.15 COPY Cargo.toml Cargo.lock rust-toolchain.toml ./16 # The root workspace names the engine crates. Each bundle is its own workspace17 # and its own image; the control build neither compiles a plugin nor copies an18 # engine library.19 COPY crates ./crates20 RUN --mount=type=cache,target=/usr/local/cargo/registry \21     --mount=type=cache,target=/cache/target \22     CARGO_TARGET_DIR=/cache/target cargo build --locked --release --workspace \23     && install -d /out/bin \24     && install -m 0755 /cache/target/release/inf3r-web /out/bin/inf3r-web \25     && install -m 0755 /cache/target/release/inf3r /out/bin/inf3r \26     && install -m 0755 /cache/target/release/inf3r-probe /out/bin/inf3r-probe27 28 # The runtime image holds the control binaries and no plugin binary and no29 # engine library. An engine is a sibling container from its own bundle image.30 # `uv` runs the Python engine of the echo bundle, and the system Python keeps it31 # from downloading an interpreter at request time.32 FROM ${UV_IMAGE} AS uv33 34 FROM ${DEBIAN_IMAGE} AS control35 ARG RUST_IMAGE36 ARG DEBIAN_IMAGE37 ARG UV_IMAGE38 LABEL org.inf3r.control.base.rust="${RUST_IMAGE}" \39       org.inf3r.control.base.debian="${DEBIAN_IMAGE}" \40       org.inf3r.control.base.uv="${UV_IMAGE}"41 # python3 is the healthcheck and the echo fixture runtime; procps supplies the42 # pgrep that the compose proof uses to show no plugin process is in the control.43 # The state directory is the only path that the server writes.44 RUN apt-get update \45     && apt-get install -y --no-install-recommends python3 procps \46     && rm -rf /var/lib/apt/lists/* \47     && install -d /var/lib/inf3r \48     && install -d /opt/inf3r/bin /opt/inf3r/plugins /opt/inf3r/plugins-extra /etc/inf3r \49     && touch /opt/inf3r/images.lock50 # The operator may mount another deploy file over this one.51 COPY --from=build /out/bin/ /usr/local/bin/52 # The control reads bundle manifests; it never receives a plugin binary or an53 # engine library. The compose service builds this target only.54 COPY plugins/mock/x64-cpu/bundle.toml plugins/mock/x64-cpu/target.toml plugins/mock/x64-cpu/BUNDLE.md /opt/inf3r/plugins/mock/x64-cpu/55 COPY plugins/mock/x64-cpu/models /opt/inf3r/plugins/mock/x64-cpu/models56 COPY --from=uv /uv /usr/local/bin/uv57 COPY docker/config/deploy.toml /etc/inf3r/deploy.toml58 # The entry point writes the first bearer token into the state volume, so59 # `docker compose up` serves without a secret baked into the image.60 COPY docker/entrypoint.sh /usr/local/bin/inf3r-entrypoint61 RUN chmod 0755 /usr/local/bin/inf3r-entrypoint62 # The control runs as container root. Rootless Docker maps that root to the63 # unprivileged host uid, so it is not host root; it matches the root-mapped64 # engine containers that must connect to the control's private sockets (D28).65 USER 0:066 EXPOSE 808067 ENTRYPOINT ["/usr/local/bin/inf3r-entrypoint"]