File size: 845 Bytes
9373610
9e88f57
9373610
 
9e88f57
9373610
 
9e88f57
9373610
 
 
 
9e88f57
9373610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
   FROM python:3.10-slim

   # Create a non-root user for security (required for Hugging Face Spaces Dev Mode)
   RUN useradd -m -u 1000 user

   # Set working directory
   WORKDIR /app

   # Copy requirements file and install dependencies
   COPY --chown=user ./requirements.txt requirements.txt
   RUN pip install --no-cache-dir --upgrade pip && \
       pip install --no-cache-dir -r requirements.txt

   # Copy the rest of the application code
   COPY --chown=user . /app

   # Switch to non-root user
   USER user

   # Set environment variables for Hugging Face Spaces
   ENV HOME=/home/user \
       PATH=/home/user/.local/bin:$PATH \
       PYTHONUNBUFFERED=1

   # Expose port 7860 (default for Hugging Face Spaces)
   EXPOSE 7860

   # Command to run the application
   CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]