Dockerfile.base 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. FROM debian:13-slim
  2. ARG REPO_USER
  3. ARG REPO_PASS
  4. ENV DEBIAN_FRONTEND=noninteractive
  5. RUN apt-get update && apt-get install -y --no-install-recommends \
  6. ca-certificates curl gnupg cmake ninja-build g++ pkg-config git \
  7. nlohmann-json3-dev libspdlog-dev libfmt-dev libssl-dev libsystemd-dev \
  8. libidn2-dev \
  9. protobuf-compiler libprotobuf-dev libgrpc++-dev protobuf-compiler-grpc \
  10. && rm -rf /var/lib/apt/lists/*
  11. # libidn2-dev is here so the VENDORED curl really gets IDN, which control.runner
  12. # has always DECLARED (`libidn2-0`) and this file's own note called a deliberate
  13. # trade: "mail hostnames are usually ASCII, but breaking an internationalised one
  14. # to save a dependency is the wrong trade." Measured 2026-10-22 and the trade was
  15. # never actually made - without this package curl's configure logged "Package
  16. # 'libidn2' ... not found" and reported `Features: AsynchDNS IPv6 Largefile SSL
  17. # threadsafe UnixSockets` with no IDN, while `objdump -p` on the shipped runner
  18. # showed no libidn2 among its NEEDED libraries. So the hand-written Depends line
  19. # was evidence of INTENT and was read as evidence of fact, and an
  20. # internationalised mail hostname would have failed with nothing explaining why.
  21. # Verify after any base rebuild by reading curl's own `-- Features:` line from
  22. # the build log, never the Depends list.
  23. #
  24. # Note: the gRPC/protobuf dev packages above are required so that the cmake
  25. # config shipped by libsmartbotic-db-client-dev can resolve `find_dependency(gRPC
  26. # CONFIG)`. Without protobuf-compiler-grpc, trixie's gRPCTargets.cmake references
  27. # plugin files that aren't present and find_package fails fatally (before the
  28. # pkg-config fallback). Mirrors smartbotic-database's build base.
  29. # Node 22 for the web UI build (vite 7 needs node >=20.19/22).
  30. RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
  31. && apt-get install -y --no-install-recommends nodejs \
  32. && rm -rf /var/lib/apt/lists/*
  33. # Smartbotics apt repo - provides libsmartbotic-db-client-dev.
  34. #
  35. # The client version is PINNED on purpose. vectorapi links
  36. # libsmartbotic-db-client.so, and every 2.x shares one SONAME, so a deb built
  37. # against a newer client installs happily next to an older one on the target and
  38. # only segfaults on the next service restart. Keep this equal to the client
  39. # version installed on the deploy target; when the target's DB moves, bump this
  40. # and ship both together.
  41. ARG DB_CLIENT_VERSION=2.20.0-1
  42. # Publishing a new client re-indexes the apt pool, so the pinned version is
  43. # often no longer installable from the repo. build.sh copies the matching .debs
  44. # here from DEB_REPO_DIR when it finds them; an empty dir falls back to apt.
  45. COPY packaging/vendor/ /tmp/db-client-vendor/
  46. RUN curl -fsSL https://repository.smartbotics.ai/smartbotics-repo.gpg \
  47. | gpg --dearmor -o /usr/share/keyrings/smartbotics-repo.gpg \
  48. && printf 'machine repository.smartbotics.ai\nlogin %s\npassword %s\n' "$REPO_USER" "$REPO_PASS" \
  49. > /etc/apt/auth.conf.d/smartbotics.conf \
  50. && chmod 600 /etc/apt/auth.conf.d/smartbotics.conf \
  51. && echo "deb [signed-by=/usr/share/keyrings/smartbotics-repo.gpg] https://repository.smartbotics.ai trixie main" \
  52. > /etc/apt/sources.list.d/smartbotics.list \
  53. && apt-get update \
  54. && if ls /tmp/db-client-vendor/*.deb >/dev/null 2>&1; then \
  55. apt-get install -y --no-install-recommends /tmp/db-client-vendor/*.deb; \
  56. else \
  57. apt-get install -y --no-install-recommends \
  58. "libsmartbotic-db-client-dev=${DB_CLIENT_VERSION}" \
  59. "libsmartbotic-db-client=${DB_CLIENT_VERSION}"; \
  60. fi \
  61. && dpkg-query -W -f='pinned client: ${Package} ${Version}\n' libsmartbotic-db-client \
  62. && rm -rf /var/lib/apt/lists/* /tmp/db-client-vendor