AI_Calling_Agent / Dockerfile
Arnavkumar01's picture
Changes made in requirements.txt, dockerfile and main.py to handle twilio websocket connection
6ee9d08
raw
history blame contribute delete
914 Bytes
# 1. Start with a lean and official Python base image
FROM python:3.10-slim
# Install dependencies for psycopg2 and audio processing
RUN apt-get update && apt-get install -y libpq-dev ffmpeg && rm -rf /var/lib/apt/lists/*
# 2. Set the working directory inside the container
WORKDIR /app
# 3. Create a non-root user and set up cache
RUN useradd -m -u 1000 user
RUN mkdir -p /app/.cache && chown -R user:user /app/.cache
ENV HF_HOME="/app/.cache"
USER user
# Add local bin directory to PATH
ENV PATH="/home/user/.local/bin:${PATH}"
# 4. Copy and install dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy the app source code
COPY --chown=user:user . .
# 6. Expose the port used by Hugging Face Spaces
EXPOSE 7860
# 7. Run the FastAPI app using Uvicorn (better for WebSockets)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]