Files
wifi-ruview/docker/docker-entrypoint.sh
T
ruv 8cb8a37dc4 feat(docker): bundle homecore-server (HOMECORE / ADRs 126-134) in the image
The HOMECORE native Rust port of Home Assistant landed in v0.10.0
(PR #800). The published Docker image now ships its binary alongside
sensing-server and cog-ha-matter so a single `docker run` brings up
the full RuView + HA-wire-compatible stack.

Dockerfile.rust:
  - cargo build --release -p homecore-server in the build stage
  - strip the new binary
  - copy /app/homecore-server in the runtime stage
  - sanity-check: image build now fails if /app/homecore-server isn't
    executable (same guard pattern that already covers sensing-server
    and cog-ha-matter)
  - EXPOSE 8123 (HA-compat REST + WebSocket port — homecore-api
    binds 0.0.0.0:8123 by default per its --bind CLI flag)

docker-entrypoint.sh:
  - new dispatch keyword: `homecore` or `homecore-server`
    Usage: docker run --network host ruvnet/wifi-densepose:latest homecore
    Defaults --bind to 0.0.0.0:8123 (overridable via HOMECORE_BIND env)

The existing two dispatch paths (no arg → sensing-server, `cog-ha-matter`
→ HA + Matter cog) keep working unchanged. Three-binary image, one
entrypoint, operator picks the role at run time.

Triggers a workflow rebuild on push to main per the docker workflow's
path filter; the multi-arch (amd64 + arm64) image will be published
to Docker Hub as `ruvnet/wifi-densepose:latest` after CI green.

Refs ADRs 126-134, v0.10.0 release.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-25 23:06:14 -04:00

56 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Docker entrypoint for WiFi-DensePose sensing server.
#
# Supports two usage patterns:
#
# 1. No arguments — use defaults from environment:
# docker run -e CSI_SOURCE=esp32 ruvnet/wifi-densepose:latest
#
# 2. Pass CLI flags directly:
# docker run ruvnet/wifi-densepose:latest --source esp32 --tick-ms 500
# docker run ruvnet/wifi-densepose:latest --model /app/models/my.rvf
#
# Environment variables:
# CSI_SOURCE — data source: auto (default), esp32, wifi, simulated
# MODELS_DIR — directory to scan for .rvf model files (default: data/models)
set -e
# Route to cog-ha-matter (ADR-116) when invoked as:
# docker run <image> cog-ha-matter [--flags]
# or via the short alias `ha-matter`. Strips the keyword and execs the
# Home Assistant + Matter cog binary, defaulting --sensing-url to the
# co-located sensing-server endpoint so docker-compose deployments work
# out of the box.
case "${1:-}" in
cog-ha-matter|ha-matter)
shift
exec /app/cog-ha-matter \
--sensing-url "${SENSING_URL:-http://127.0.0.1:3000}" \
"$@"
;;
homecore|homecore-server)
# Route to the HOMECORE native Rust port of Home Assistant
# (ADRs 126-134, v0.10.0). Default bind matches HA at :8123.
shift
exec /app/homecore-server \
--bind "${HOMECORE_BIND:-0.0.0.0:8123}" \
"$@"
;;
esac
# If the first argument looks like a flag (starts with -), prepend the
# server binary so users can just pass flags:
# docker run <image> --source esp32 --tick-ms 500
if [ "${1#-}" != "$1" ] || [ -z "$1" ]; then
set -- /app/sensing-server \
--source "${CSI_SOURCE:-auto}" \
--tick-ms 100 \
--ui-path /app/ui \
--http-port 3000 \
--ws-port 3001 \
--bind-addr 0.0.0.0 \
"$@"
fi
exec "$@"