kisaansaathi / Dockerfile
agentsay's picture
Update Dockerfile
2e0d130 verified
raw
history blame contribute delete
747 Bytes
# Use official Python 3.9 slim image as base (smaller footprint than full Python image)
FROM python:3.9-slim
# Create non-root user as recommended by Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /home/user/app
# Copy requirements first (optimization for caching)
COPY --chown=user:user ./requirements.txt requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user:user . .
# Expose port (7860 is the default for Hugging Face Spaces)
EXPOSE 7860
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]