Commit ·
65b6449
1
Parent(s): 3c91fc8
fix: prevent port conflict in HF Spaces dev mode
Browse filesDev mode spawns CMD multiple times on restart, causing EADDRINUSE.
Wrap uvicorn in a start script that kills any prior instance first.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (2)
- Dockerfile+1-1
- backend/start.shAdded+7
55 unmodified lines5657585955 unmodified lines# Run the application from backend directoryWORKDIR /app/backendCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]55 unmodified lines5657585955 unmodified lines# Run the application from backend directoryWORKDIR /app/backendCMD ["bash", "start.sh"]
1234567#!/bin/bash# Entrypoint for HF Spaces dev mode compatibility.# Dev mode may spawn the CMD multiple times; kill any prior# uvicorn instance so the new one can bind the port.pkill -f "uvicorn main:app" 2>/dev/null || truesleep 0.3exec uvicorn main:app --host 0.0.0.0 --port 7860Dockerfile+1-1
backend/start.shAdded+7