From 5fd73001f7850967bfbc2d5f2105df6489e13a64 Mon Sep 17 00:00:00 2001 From: Nicolas Varrot Date: Wed, 11 Feb 2026 16:31:33 +0000 Subject: [PATCH] feat: add Docker support with Dockerfile, compose, CI, and oneliner install - Multi-stage Dockerfile (node build + nginx:alpine serve) - nginx.conf with SPA fallback, gzip, asset caching - docker-compose.yml for easy deployment - GitHub Actions workflow to build & push to ghcr.io on every push - .dockerignore to keep image lean - Updated README with Docker-first quick start and badge --- .dockerignore | 7 +++++++ .github/workflows/docker.yml | 39 ++++++++++++++++++++++++++++++++++++ Dockerfile | 14 +++++++++++++ FEEDBACK.md | 13 +++++++++++- README.md | 30 +++++++++++++++++---------- docker-compose.yml | 8 ++++++++ nginx.conf | 21 +++++++++++++++++++ 7 files changed, 120 insertions(+), 12 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2be41f1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +dist +.env +.env.* +!.env.example +.git +*.md diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..3e6c88d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,39 @@ +name: Docker + +on: + push: + branches: [main] + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=latest + type=sha,prefix= + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5112c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Stage 1: Build +FROM node:22-alpine AS build +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Stage 2: Serve +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/FEEDBACK.md b/FEEDBACK.md index 15295ca..8db3ce2 100644 --- a/FEEDBACK.md +++ b/FEEDBACK.md @@ -43,7 +43,7 @@ ## Item #6 - **Date:** 2026-02-11 - **Priority:** high -- **Status:** pending +- **Status:** in-progress - **Description:** Installation simplifiée — Docker + oneliner - **Dockerfile** : image légère (nginx:alpine ou similar) qui sert le build statique. Multi-stage : node pour build, nginx pour serve. Pas de secrets dans l'image (tout est runtime via le login screen). - **docker-compose.yml** : exemple simple avec juste le container PinchChat @@ -51,3 +51,14 @@ - **Oneliner** : `docker run -p 3000:80 ghcr.io/marlburrow/pinchchat:latest` dans le README - Alternative sans Docker : `npx pinchchat` ou un script curl qui télécharge le dernier release (build statique) et lance un serveur - Mettre à jour le README avec les nouvelles méthodes d'installation + +## Item #7 +- **Date:** 2026-02-11 +- **Priority:** high +- **Status:** pending +- **Description:** Affichage des images dans le chat + - Rendre les images inline dans les messages (quand le gateway envoie des images en base64/URL via `mediaUrls` ou content blocks de type image) + - Rendre les images dans les tool results (quand un tool `read` retourne une image, l'afficher au lieu de juste "Read image file [image/png]") + - Support des formats courants : png, jpg, gif, webp + - Les images doivent être cliquables pour voir en taille réelle (lightbox ou nouvel onglet) + - Garder le style dark theme cohérent (bordures arrondies, pas de fond blanc autour des images) diff --git a/README.md b/README.md index dd86001..3fef21b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![CI](https://github.com/MarlBurroW/pinchchat/actions/workflows/ci.yml/badge.svg)](https://github.com/MarlBurroW/pinchchat/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/) +[![Docker](https://img.shields.io/badge/docker-ghcr.io-blue)](https://github.com/MarlBurroW/pinchchat/pkgs/container/pinchchat) **A sleek, dark-themed webchat UI for [OpenClaw](https://github.com/openclaw/openclaw) — monitor sessions, stream responses, and inspect tool calls in real-time.** @@ -22,18 +23,31 @@ ## 🚀 Quick Start -### Prerequisites +### Docker (recommended) -- **Node.js 18+** -- **OpenClaw gateway** running and accessible +```bash +docker run -p 3000:80 ghcr.io/marlburrow/pinchchat:latest +``` -### Installation +Open `http://localhost:3000` and enter your OpenClaw gateway URL + token on the login screen. + +Or use Docker Compose: + +```bash +curl -O https://raw.githubusercontent.com/MarlBurroW/pinchchat/main/docker-compose.yml +docker compose up -d +``` + +### From source + +**Prerequisites:** Node.js 18+, an OpenClaw gateway running and accessible. ```bash git clone https://github.com/MarlBurroW/pinchchat.git cd pinchchat npm install cp .env.example .env +npm run dev ``` Optionally edit `.env` to pre-fill the gateway URL: @@ -43,13 +57,7 @@ VITE_GATEWAY_WS_URL=ws://localhost:18789 VITE_LOCALE=en # or "fr" for French UI ``` -Start the dev server: - -```bash -npm run dev -``` - -### Production +### Production build ```bash npm run build diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d7f1deb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + pinchchat: + image: ghcr.io/marlburrow/pinchchat:latest + # Or build locally: + # build: . + ports: + - "3000:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5d4f5a2 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Gzip + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml; + gzip_min_length 256; +}