feat(docker): add multi-stage CLI image and CI smoke test
NI
5d ago+132+132+012345678901234567890123456789-0-0-0123456789
Closes #11.
Summary
Adds a minimal, multi-stage Docker image so docker run --rm -v "$PWD":/work anydoc convert <file> produces the same Markdown as the local cargo run --example convert. No bindings, no service, no registry push.
- Builder
rust:1.88-bookwormcompilesexamples/convert.rswith--release --locked(PDF support is included by default —pdf-inspectoris a plain dependency, no feature flags exist inCargo.toml). - Runtime
debian:bookworm-slimcarries only theconvertbinary +ca-certificates;WORKDIR /work,ENTRYPOINT ["convert"]. Documents are read from a mounted volume — nothing is baked in. .dockerignorekeepstarget/,node_modules/, binding build artifacts, and agent scratch dirs out of the context.- CI adds a
dockerjob that builds the image and runs one smoke conversion againsttests/fixtures/docx/text.docx, so the Dockerfile cannot silently rot.
Why debian over alpine
pdf-inspector and its deps (lopdf, rayon, ttf-parser) are pure Rust — there are no native deps that block musl — but glibc matches the CI runner (ubuntu-2404) and a fully-static musl validation is deferred to a follow-up rather than shipped unvalidated for v1.
Verification
cargo fmt --all --check✅cargo clippy --workspace --all-targets --all-features -- -D warnings✅cargo build --release --locked --example convert✅docker build -t anydoc .✅ ondarwin/arm64- Image size: 33 MB (target was < 200 MB)
- CLI parity:
docker run … convert tests/fixtures/docx/text.docxoutput is byte-identical to localconvert(1316 bytes both). - Negative paths: no-args → prints
usage:+ exit 1; missing file → clear error + exit 1. - Branch rebased on current
main.
Scope / follow-ups (out of scope here)
- No stdin (
-) support:examples/convert.rsalways reads a file path — it has no stdin branch. This is deferred to #29 (the standalonesrc/bin/anydoc.rsCLI), which owns real stdin. Documented as a spec gap, not silently dropped. - arm64 in CI: CI builds
amd64only (QEMU emulation is slow); the Dockerfile is arch-neutral, verified locally on arm64. - Registry publishing (GHCR/Docker Hub): maintainer decision, not included.
- Non-root
USERhardening: deferred to a follow-up (the plan calls this out).
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.