Spaces:
Sleeping
Sleeping
File size: 797 Bytes
b0634d8 419f107 b0634d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# Use an official Python runtime as the base image
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies (e.g., for FAISS)
RUN apt-get update && apt-get install -y \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY main.py .
# Create a non-root user and set permissions
RUN useradd -m -u 1000 appuser \
&& mkdir -p /app/.cache \
&& chown -R appuser:appuser /app
# Switch to the non-root user
USER appuser
# Expose the port (Hugging Face Spaces expects 7860)
EXPOSE 7860
# Command to run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |