homelab/services/device-inventory/Dockerfile
Dan V e1a482c500 feat(device-inventory): add hooks system and DNS updater hook
- Add Hook interface (filter + execute contract) in server/hooks/hook.h
- Add HookRunner in server/hooks/hook_runner.h: spawns a detached thread
  per matching hook, with try/catch protection against crashes
- Add DnsUpdaterHook in server/hooks/dns_updater_hook.{h,cpp}:
  triggers on server name changes, logs in to Technitium, deletes the
  old A record (ignores 404), and adds the new A record
  Config via env vars: TECHNITIUM_HOST/PORT/USER/PASS/ZONE, DNS_TTL
- Add Database::get_nics_for_server() to resolve a server's IPv4 address
- Wire HookRunner into InventoryServer; cmd_edit_server now fires hooks
  with before/after Server snapshots
- Update CMakeLists.txt to include dns_updater_hook.cpp
- Document env vars in Dockerfile

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 14:58:36 +01:00

25 lines
981 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM ubuntu:24.04 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake make g++ && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN rm -rf build && cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && \
cmake --build build --parallel
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
libstdc++6 && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /var/lib/inventory
COPY --from=builder /src/build/inventory-server /usr/local/bin/
EXPOSE 9876
VOLUME ["/var/lib/inventory"]
# DNS updater hook env vars (set at runtime do not bake secrets into the image):
# TECHNITIUM_HOST (default: 192.168.2.193)
# TECHNITIUM_PORT (default: 5380)
# TECHNITIUM_USER (default: admin)
# TECHNITIUM_PASS (required for DNS updates)
# TECHNITIUM_ZONE (default: homelab)
# DNS_TTL (default: 300)
CMD ["inventory-server", "--port", "9876", "--db", "/var/lib/inventory/data.db"]