SyedaArisha's picture
Upload folder using huggingface_hub
baf834b verified
Raw History Blame Contribute Delete
1.07 kB
# Use official Python 3.12 slim image for a smaller footprint
FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create a non-root user for Hugging Face Spaces security
RUN useradd -m -u 1000 user
# Set the working directory
WORKDIR /app
# Install system dependencies (needed for FAISS and compiling some ML packages)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the entire project directory into the container
# Ensure large unused raw data is ignored via .dockerignore
COPY --chown=user:user . /app
# Switch to the non-root user
USER user
# Expose port 7860 which is required by Hugging Face Spaces
EXPOSE 7860
# Launch the FastAPI app via Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]