mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-22 07:34:47 +02:00
Add web-based config interface via ttyd
- Install ttyd in Docker image for browser-based TUI access - Create docker-entrypoint.sh to run ttyd + bot with auto-restart - Expose port 7681 for web config access - Update docker-compose.yml with proper configuration Access config at http://localhost:7681 after starting container 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fd3f995ebb
commit
389e59c18e
3 changed files with 224 additions and 27 deletions
75
Dockerfile
75
Dockerfile
|
|
@ -1,18 +1,54 @@
|
|||
FROM python:3.11-slim
|
||||
# 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
|
||||
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
LABEL maintainer="K7ZVX <matt@echo6.co>"
|
||||
LABEL description="MeshAI - LLM-powered Meshtastic assistant"
|
||||
LABEL version="0.1.0"
|
||||
|
||||
# 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 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# For serial communication
|
||||
udev \
|
||||
# For health checks
|
||||
curl \
|
||||
# For process management
|
||||
procps \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
# Install ttyd for web-based config interface
|
||||
&& curl -sL https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 -o /usr/local/bin/ttyd \
|
||||
&& chmod +x /usr/local/bin/ttyd
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -m -s /bin/bash meshai
|
||||
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
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements first for layer caching
|
||||
|
|
@ -20,22 +56,27 @@ COPY requirements.txt .
|
|||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY meshai/ ./meshai/
|
||||
COPY pyproject.toml .
|
||||
COPY README.md .
|
||||
COPY --chown=meshai:meshai meshai/ ./meshai/
|
||||
COPY --chown=meshai:meshai pyproject.toml .
|
||||
COPY --chown=meshai:meshai README.md .
|
||||
COPY --chown=meshai:meshai config.example.yaml .
|
||||
COPY --chown=meshai:meshai docker-entrypoint.sh .
|
||||
|
||||
# Install the package and fix permissions
|
||||
RUN pip install --no-cache-dir -e . && \
|
||||
chown -R meshai:meshai /app
|
||||
|
||||
# Create data directory for config and database
|
||||
RUN mkdir -p /data && chown meshai:meshai /data
|
||||
# Install the package
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
# Switch to non-root user
|
||||
USER meshai
|
||||
|
||||
# Set working directory to data for config files
|
||||
WORKDIR /data
|
||||
# Data volume mount point
|
||||
VOLUME ["/data"]
|
||||
|
||||
# Default command
|
||||
CMD ["python", "-m", "meshai"]
|
||||
# Expose ttyd web config port
|
||||
EXPOSE 7681
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD python -c "import sqlite3; sqlite3.connect('/data/conversations.db').execute('SELECT 1')" || exit 1
|
||||
|
||||
# Entrypoint handles config and ttyd
|
||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue