docker/Containerfile.release 3.6 KiB 70 lines Raw
1 # syntax=docker/dockerfile:12 # The release control/probe image. It contains the three binaries, the glibc3 # runtime they need, and nothing else: no shell, no package manager, no Python,4 # no bundle, and no engine library. The build stage is not part of the final5 # image, so its Debian base does not consume a published layer.6 ARG RUST_IMAGE=rust:1.99.1-bookworm@sha256:e6f2cff35d0f309acf8433b4f05878ed77092602c5065cc81801177da0bb3a9c7 ARG DEBIAN_IMAGE=debian:bookworm-slim@sha256:734a72b3d6142a71993b4bc580ca01d8ca687f77a2c422d96a961d3376b179bc8 FROM ${RUST_IMAGE} AS build9 WORKDIR /src10 COPY Cargo.toml Cargo.lock rust-toolchain.toml ./11 COPY crates ./crates12 ARG SOURCE_DATE_EPOCH=013 ENV SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}14 RUN --mount=type=cache,target=/usr/local/cargo/registry \15     --mount=type=cache,target=/cache/target \16     CARGO_TARGET_DIR=/cache/target \17     RUSTFLAGS="--remap-path-prefix=/src=/src --remap-path-prefix=/usr/local/cargo=/cargo --remap-path-prefix=/usr/local/rustup=/rustup" \18     cargo build --locked --release --workspace \19     && install -d /out/bin \20     && install -m 0755 /cache/target/release/inf3r-web /out/bin/inf3r-web \21     && install -m 0755 /cache/target/release/inf3r /out/bin/inf3r \22     && install -m 0755 /cache/target/release/inf3r-probe /out/bin/inf3r-probe23 24 # The runtime root is a small glibc filesystem copied out of the pinned Debian25 # image. It is deliberately built in a stage so the compiler base never becomes26 # a published layer. The host docker CLI and the CDI nvidia-smi are both27 # dynamically linked against this ABI.28 FROM ${DEBIAN_IMAGE} AS rootfs29 ARG INF3R_VERSION=1.0.030 ARG INF3R_COMMIT=unknown31 ARG INF3R_TAG=none32 ARG SOURCE_DATE_EPOCH=033 RUN install -d /rootfs/usr/lib/x86_64-linux-gnu /rootfs/usr/lib64 \34         /rootfs/etc/inf3r /rootfs/var/lib/inf3r /rootfs/opt/inf3r/bin \35         /rootfs/opt/inf3r/plugins /rootfs/opt/inf3r/plugins-extra \36         /rootfs/usr/share/licenses/inf3r /rootfs/usr/share/doc/inf3r /rootfs/tmp \37         /rootfs/run/inf3r \38     && cp /usr/lib/x86_64-linux-gnu/libc.so.6 \39           /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 \40           /usr/lib/x86_64-linux-gnu/libm.so.6 \41           /usr/lib/x86_64-linux-gnu/libpthread.so.0 \42           /usr/lib/x86_64-linux-gnu/libdl.so.2 \43           /usr/lib/x86_64-linux-gnu/librt.so.1 \44           /usr/lib/x86_64-linux-gnu/libresolv.so.2 \45           /rootfs/usr/lib/x86_64-linux-gnu/ \46     && cp /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \47           /rootfs/usr/lib64/ld-linux-x86-64.so.2 \48     && ln -s usr/lib /rootfs/lib \49     && ln -s usr/lib64 /rootfs/lib64 \50     && chmod 1777 /rootfs/tmp \51     && chmod 0777 /rootfs/var/lib/inf3r /rootfs/run/inf3r \52     && chown -R 10000:10000 /rootfs/opt/inf3r \53     && printf 'inf3r %s\nCopyright (C) 2026 gl0w\nLicense: AGPL-3.0-only\n\nCommit: %s\nTag: %s\nSource: https://inf3r.gl0w.world/repo.git\nBundle: https://inf3r.gl0w.world/repo.bundle\nArchive: https://inf3r.gl0w.world/repo.tar.gz\nSource date: %s\n' \54           "$INF3R_VERSION" "$INF3R_COMMIT" "$INF3R_TAG" "$SOURCE_DATE_EPOCH" \55           > /rootfs/usr/share/doc/inf3r/SOURCE56 57 FROM scratch58 COPY --from=build /out/bin/ /usr/local/bin/59 COPY --from=rootfs /rootfs/ /60 COPY LICENSE NOTICE README.md /usr/share/doc/inf3r/61 COPY docker/config/release.toml /etc/inf3r/deploy.toml62 ENV PATH=/usr/local/bin63 USER 10000:1000064 EXPOSE 808065 # No shell is needed for the health check: the cli asks the same route a client66 # asks, and exits non-zero on anything other than 200.67 HEALTHCHECK --interval=5s --timeout=3s --retries=12 --start-period=30s \68     CMD ["/usr/local/bin/inf3r", "healthz", "--tcp", "localhost:8080"]69 ENTRYPOINT ["/usr/local/bin/inf3r-web"]70 CMD ["--deploy", "/etc/inf3r/deploy.toml"]