Charan S commited on
Commit Β·
f419df4
1
Parent(s): b06c2b5
Add HuggingFace dockerfile
Browse filesFiles changed (7)
- Dockerfile+5-5
- README.mdAdded+19
- config.py+3-1
- main.py+1-1
- railway.tomlDeleted-10
- start.sh+11-5
- supervisord.confAdded+24
123456789101112131415161718192021222324FROM python:3.11-slim# Build deps for asyncpg, chromadb, PyMuPDFRUN apt-get update && apt-get install -y --no-install-recommends \gcc g++ libpq-dev \&& rm -rf /var/lib/apt/lists/*WORKDIR /appCOPY requirements.txt .# CPU-only PyTorch β avoids pulling 2GB CUDA wheelsRUN pip install --no-cache-dir torch --extra-index-url https://download.pytorch.org/whl/cpuRUN pip install --no-cache-dir -r requirements.txtCOPY . .# Bake embedding model into image β zero cold-start latency on first KB queryRUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"EXPOSE 8000CMD ["sh", "start.sh"]123456789101112131415161718192021222324FROM python:3.11-slimRUN apt-get update && apt-get install -y --no-install-recommends \gcc g++ libpq-dev supervisor \&& rm -rf /var/lib/apt/lists/*WORKDIR /appCOPY requirements.txt .# CPU-only PyTorch β avoids pulling 2 GB of CUDA wheelsRUN pip install --no-cache-dir torch --extra-index-url https://download.pytorch.org/whl/cpuRUN pip install --no-cache-dir -r requirements.txtCOPY . .# Bake the embedding model into the image so first KB query has zero cold-startRUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"# HuggingFace Spaces routes external traffic to port 7860EXPOSE 7860CMD ["sh", "start.sh"]
12345678910111213141516171819---title: Wavvyemoji: ποΈcolorFrom: yellowcolorTo: purplesdk: dockerpinned: falseapp_port: 7860---
# Wavvy Backend
Real-time voice AI CCaaS platform β FastAPI + LiveKit Agents worker.
Two processes run inside this Space via supervisord:- **API** β FastAPI on port 7860 (REST + WebSockets)- **Worker** β LiveKit Agents worker (voice pipeline per call)
See the [main repository](https://github.com/charansrinivas108/wavvy) for full documentation.35 unmodified lines3637383940414235 unmodified lines# SIP/PSTN β public URL used as LiveKit webhook target for inbound SIP callspublic_backend_url: str = "http://localhost:8000"# Internal URL workers use to call FastAPI (same host, typically localhost)backend_internal_url: str = "http://localhost:8000"@property35 unmodified lines36373839404142434435 unmodified lines# SIP/PSTN β public URL used as LiveKit webhook target for inbound SIP callspublic_backend_url: str = "http://localhost:8000"# Internal URL workers use to call FastAPI.# On HuggingFace both processes share the container β start.sh sets this to :7860.# Local dev uses :8000 (uvicorn default).backend_internal_url: str = "http://localhost:8000"@property
93 unmodified lines94959697989910093 unmodified linesapp.add_middleware(CORSMiddleware,allow_origins=["*"] if settings.environment == "development" else settings.allowed_origins,allow_credentials=True,allow_methods=["*"],allow_headers=["*"],93 unmodified lines94959697989910093 unmodified linesapp.add_middleware(CORSMiddleware,allow_origins=["*"],allow_credentials=True,allow_methods=["*"],allow_headers=["*"],
12345678910[build]builder = "DOCKERFILE"dockerfilePath = "Dockerfile"
[deploy]startCommand = "sh start.sh"healthcheckPath = "/api/health"healthcheckTimeout = 300restartPolicyType = "ON_FAILURE"restartPolicyMaxRetries = 312345678910111213141516171819#!/bin/shset -e# Railway PostgreSQL addon provides DATABASE_URL as postgres:// or postgresql://# SQLAlchemy asyncpg driver requires postgresql+asyncpg://if [ -n "$DATABASE_URL" ]; thenexport DATABASE_URL=$(echo "$DATABASE_URL" \| sed 's|^postgres://|postgresql+asyncpg://|' \| sed 's|^postgresql://|postgresql+asyncpg://|')fiecho "βΆ Running database migrations..."alembic upgrade headecho "βΆ Seeding demo data..."python seed.py || echo "Seed skipped (already up to date)"echo "βΆ Starting Wavvy API..."exec uvicorn main:app --host 0.0.0.0 --port "${PORT:-8000}"12345678910111213141516171819202122232425#!/bin/shset -e# Supabase / Neon provide postgres:// β SQLAlchemy asyncpg needs postgresql+asyncpg://if [ -n "$DATABASE_URL" ]; thenexport DATABASE_URL=$(echo "$DATABASE_URL" \| sed 's|^postgres://|postgresql+asyncpg://|' \| sed 's|^postgresql://|postgresql+asyncpg://|')fi# HuggingFace persistent volume β ChromaDB lives here across restartsmkdir -p /data/chroma_dbexport CHROMA_PERSIST_DIR=${CHROMA_PERSIST_DIR:-/data/chroma_db}# Both processes run in this container β worker calls /api/kb/search on localhostexport BACKEND_INTERNAL_URL=${BACKEND_INTERNAL_URL:-http://localhost:7860}echo "βΆ Running database migrations..."alembic upgrade headecho "βΆ Seeding demo data..."python seed.py || echo " Seed skipped (already up to date)"echo "βΆ Starting Wavvy API + LiveKit Worker..."exec supervisord -c supervisord.conf
123456789101112131415161718192021222324[supervisord]nodaemon=truelogfile=/tmp/supervisord.logpidfile=/tmp/supervisord.pid
[program:api]command=uvicorn main:app --host 0.0.0.0 --port 7860 --workers 2directory=/appautostart=trueautorestart=truestdout_logfile=/dev/stdoutstdout_logfile_maxbytes=0stderr_logfile=/dev/stderrstderr_logfile_maxbytes=0
[program:worker]command=python -m voice.agent_worker startdirectory=/appautostart=trueautorestart=truestdout_logfile=/dev/stdoutstdout_logfile_maxbytes=0stderr_logfile=/dev/stderrstderr_logfile_maxbytes=0Dockerfile+5-5
README.mdAdded+19
config.py+3-1
main.py+1-1
railway.tomlDeleted-10
start.sh+11-5
supervisord.confAdded+24