2026-06-16 03:40:31 +00:00
|
|
|
# MeshAI Dockerfile
|
|
|
|
|
# LLM-powered Meshtastic assistant
|
|
|
|
|
#
|
|
|
|
|
# Build: docker build -t meshai .
|
|
|
|
|
# Run: docker run -d --name meshai \
|
|
|
|
|
# --device=/dev/ttyUSB0 \
|
|
|
|
|
# -p 7681:7681 \
|
|
|
|
|
# -v meshai_data:/data \
|
|
|
|
|
# meshai
|
|
|
|
|
|
|
|
|
|
# ── Stage 1: Build frontend ──
|
|
|
|
|
FROM node:20-alpine AS frontend
|
|
|
|
|
WORKDIR /build
|
|
|
|
|
COPY dashboard-frontend/ ./dashboard-frontend/
|
|
|
|
|
WORKDIR /build/dashboard-frontend
|
|
|
|
|
RUN npm ci && npm run build
|
|
|
|
|
# Output lands at /build/meshai/dashboard/static/ (via vite outDir)
|
|
|
|
|
|
|
|
|
|
# ── Stage 2: Python runtime ──
|
|
|
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
|
|
|
|
|
|
LABEL maintainer="K7ZVX <matt@echo6.co>"
|
|
|
|
|
LABEL description="MeshAI - LLM-powered Meshtastic assistant"
|
|
|
|
|
LABEL version="0.1.0"
|
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/zvx-echo6/meshai
|
|
|
|
|
LABEL org.opencontainers.image.description="MeshAI - LLM-powered Meshtastic assistant"
|
|
|
|
|
LABEL org.opencontainers.image.licenses=MIT
|
|
|
|
|
|
|
|
|
|
# Build arguments
|
|
|
|
|
ARG UID=1000
|
|
|
|
|
ARG GID=1000
|
|
|
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
|
PIP_NO_CACHE_DIR=1 \
|
|
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
gcc \
|
|
|
|
|
libc6-dev \
|
|
|
|
|
# For serial communication
|
|
|
|
|
udev \
|
|
|
|
|
# For health checks
|
|
|
|
|
curl \
|
|
|
|
|
# For process management
|
|
|
|
|
procps \
|
2026-07-05 16:21:32 -06:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2026-06-16 03:40:31 +00:00
|
|
|
|
|
|
|
|
# Create non-root user
|
|
|
|
|
RUN groupadd -g ${GID} meshai && \
|
|
|
|
|
useradd -u ${UID} -g ${GID} -m -s /bin/bash meshai && \
|
|
|
|
|
# Add to dialout group for serial access
|
|
|
|
|
usermod -aG dialout meshai
|
|
|
|
|
|
|
|
|
|
# Create directories
|
|
|
|
|
RUN mkdir -p /app /data && \
|
|
|
|
|
chown -R meshai:meshai /app /data
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Copy requirements first for layer caching
|
|
|
|
|
COPY requirements.txt .
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
# Pre-download embedding model for hybrid search
|
|
|
|
|
RUN python3 -c "from fastembed import TextEmbedding; TextEmbedding('BAAI/bge-small-en-v1.5')"
|
|
|
|
|
|
|
|
|
|
# Copy application code
|
|
|
|
|
COPY --chown=meshai:meshai meshai/ ./meshai/
|
|
|
|
|
# Overwrite with freshly built frontend assets from stage 1
|
|
|
|
|
COPY --from=frontend --chown=meshai:meshai /build/meshai/dashboard/static/ ./meshai/dashboard/static/
|
|
|
|
|
COPY --chown=meshai:meshai pyproject.toml .
|
|
|
|
|
COPY --chown=meshai:meshai README.md .
|
docs: point onboarding at the dashboard, not the legacy example config
The documented setup path was `cp config.example.yaml config.yaml`, but that
file is ~40% incomplete: of the 20 top-level Config fields it covers 15,
omitting coverage (the universal bbox), danger_zones, generic_sources,
meshcore_context, commands, and the current notification model
(toggles/destinations/region_routes). Its own notifications header still says
the schema "will be replaced in v0.3 by the 8-toggle model" -- which shipped
long ago. Anyone following the project's own instructions landed on a
degraded surface with no signal a richer config existed.
It is also read by NOTHING at runtime: docker-entrypoint.sh sets
MESHAI_CONFIG=/data/config.yaml and writes its own inline default on first
boot. The Dockerfile still COPYs config.example.yaml into the image, so it is
kept and now labelled reference-only rather than a starting point.
- README: Docker quick-start seeds itself; configure via the dashboard. The
pip path still uses config.example.yaml (nothing seeds one there) but now
carries an honest note that it is a minimal bootstrap, not a reference.
Adds an Advanced section for the split /data/config/ layout and the
migrate_config_v03 path into it.
- docker-compose.yml: the comment claimed config lives at /data/config.yaml
as though that were the only layout; corrected to describe both, and note
secrets live in /data/secrets/.env.
- Dockerfile: document why config.example.yaml is still shipped.
Not done deliberately: config.example.yaml is NOT expanded to cover all 20
sections. A second hand-maintained schema is what caused this drift; the
dashboard is the authoritative surface. The legacy single-file loader is
untouched and still fully supported.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 21:16:53 +00:00
|
|
|
# Reference only: docker-entrypoint.sh writes its own minimal default to
|
|
|
|
|
# /data/config.yaml on first boot and does NOT read this file. It's shipped
|
|
|
|
|
# for local/pip installs and anyone who wants the legacy single-file schema
|
|
|
|
|
# on hand inside the container (e.g. via `docker compose exec`).
|
2026-06-16 03:40:31 +00:00
|
|
|
COPY --chown=meshai:meshai config.example.yaml .
|
|
|
|
|
COPY --chown=meshai:meshai docker-entrypoint.sh .
|
|
|
|
|
|
|
|
|
|
# Install the package
|
|
|
|
|
RUN pip install --no-cache-dir -e .
|
|
|
|
|
|
|
|
|
|
# Switch to non-root user
|
|
|
|
|
USER meshai
|
|
|
|
|
|
|
|
|
|
# Data volume mount point
|
|
|
|
|
VOLUME ["/data"]
|
|
|
|
|
|
2026-07-05 16:21:32 -06:00
|
|
|
# Expose dashboard port
|
|
|
|
|
EXPOSE 8080
|
2026-06-16 03:40:31 +00:00
|
|
|
|
|
|
|
|
# Health check - verify bot process is alive via PID file
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
2026-06-21 05:58:23 +00:00
|
|
|
CMD test -f /tmp/meshai.pid && kill -0 $(cat /tmp/meshai.pid) 2>/dev/null && [ "$(cat /tmp/meshai.link 2>/dev/null)" = up ] || exit 1
|
2026-06-16 03:40:31 +00:00
|
|
|
|
2026-07-05 16:21:32 -06:00
|
|
|
# Entrypoint writes default config on first run, then starts the bot
|
2026-06-16 03:40:31 +00:00
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|