subbunanepalli's picture
Update Dockerfile
b079300 verified
raw
history blame contribute delete
702 Bytes
# Use official Python image
FROM python:3.9-slim
# Set working directory inside user-writable space (IMPORTANT for Hugging Face Spaces)
WORKDIR /home/user/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for cache efficiency
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy full application
COPY . .
# Set environment variable to avoid writing to /root
ENV TRANSFORMERS_CACHE=/home/user/app/.cache
# Expose FastAPI port
EXPOSE 7860
# Run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]