Team Ai
Apppublic

Decoder2704/python-chatbot-jay

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
DOCKER_LOCAL.md75 linesDownload Raw Back to docs
1# Local Docker testing (Hugging Face–style)2 3Same image as the Space: **port 7860**, **0.0.0.0** inside the container. No application code changes—only how you build and run the container.4 5**Prerequisites:** Docker Desktop or Docker Engine (Mac/Linux), repo at machine-readable paths; `backend/data` and `backend/artifacts` must be present in the build context if the app needs them at runtime.6 7---8 9## 1. Build the image10 11From the **repository root** (where `Dockerfile` is):12 13```bash14docker build -t pybot-hf:local .15```16 17---18 19## 2. Run the container20 21**Foreground** (logs in terminal; stop with Ctrl+C):22 23```bash24docker run --rm -p 7860:7860 -e PORT=7860 pybot-hf:local25```26 27**Detached** (background):28 29```bash30docker run -d --name pybot-hf -p 7860:7860 -e PORT=7860 pybot-hf:local31```32 33Stop and remove later:34 35```bash36docker stop pybot-hf && docker rm pybot-hf37```38 39---40 41## 3. Test in the browser42 431. Open: **http://127.0.0.1:7860/**  442. Confirm the chat UI loads.  453. Send a message and verify a reply.46 47---48 49## Optional: Docker Compose (same behavior)50 51From the repo root:52 53```bash54docker compose up --build55```56 57Then open **http://127.0.0.1:7860/** . Stop with Ctrl+C, or:58 59```bash60docker compose down61```62 63(See `docker-compose.yml` in the repo root.)64 65---66 67## Troubleshooting68 69| Issue | What to check |70|--------|----------------|71| Build fails | Run from repo root; ensure `frontend/package-lock.json` exists. |72| 500 when sending chat | Image may lack `backend/artifacts` or `backend/data`; confirm they are not excluded and are committed or copied into the context. |73| Blank page | Confirm `backend/static/dist` was produced in the image (Dockerfile copies Vite `dist` there). |74| Port in use | Change host mapping: `-p 8080:7860` and open `http://127.0.0.1:8080/`. |75