diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..e465b8c --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,58 @@ +name: Build and Publish + +on: + push: + branches: [ "main" ] + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=tag + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 673221d..5dc5291 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,9 @@ FROM python:3.11-slim-bookworm LABEL maintainer="K7ZVX " 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 @@ -35,8 +38,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # 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 \ + # Install ttyd for web-based config interface (arch-aware) + && TTYD_ARCH=$(dpkg --print-architecture | sed 's/amd64/x86_64/' | sed 's/arm64/aarch64/') \ + && curl -sL "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${TTYD_ARCH}" -o /usr/local/bin/ttyd \ && chmod +x /usr/local/bin/ttyd # Create non-root user diff --git a/README.md b/README.md index 2562591..f8e2ad5 100644 --- a/README.md +++ b/README.md @@ -133,20 +133,21 @@ DM: Tell me a short joke ### Quick Start with Docker ```bash -# Clone and enter directory -git clone https://github.com/zvx-echo6/meshai.git -cd meshai +# Create working directory +mkdir -p meshai/data && cd meshai -# Copy example config -cp config.example.yaml data/config.yaml +# Download docker-compose file +curl -O https://raw.githubusercontent.com/zvx-echo6/meshai/main/docker-compose.yml + +# Copy and edit config +curl -o data/config.yaml https://raw.githubusercontent.com/zvx-echo6/meshai/main/config.example.yaml # Edit data/config.yaml with your settings -# For TCP connection to Meshtastic node: -docker compose -f docker-compose.yml -f docker-compose.tcp.yml up -d +# Start +docker compose up -d -# For Serial connection: -# First edit docker-compose.serial.yml to set your device path -docker compose -f docker-compose.yml -f docker-compose.serial.yml up -d +# View logs +docker compose logs -f ``` ### Docker Configuration diff --git a/docker-compose.yml b/docker-compose.yml index 58da129..fe37313 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,13 +13,17 @@ services: meshai: - build: - context: . - dockerfile: Dockerfile - args: - UID: ${UID:-1000} - GID: ${GID:-1000} - image: meshai:latest + # Pull from GitHub Container Registry + image: ghcr.io/zvx-echo6/meshai:latest + + # Uncomment to build locally instead of pulling + # build: + # context: . + # dockerfile: Dockerfile + # args: + # UID: ${UID:-1000} + # GID: ${GID:-1000} + container_name: meshai restart: unless-stopped