File size: 698 Bytes
dce31f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

# Add user with a unique ID
RUN useradd -m -u 1000 user

# Use non-root user
USER user

# Add Python package installation path to PATH
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory to /app
WORKDIR /app

# Copy the requirements.txt to the container
COPY --chown=user ./requirements.txt requirements.txt

# Install dependencies from the requirements.txt file
RUN pip install --no-cache-dir --upgrade -r requirements.txt

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

# Expose the port for Hugging Face Spaces
EXPOSE 7860

# Set the command to start the FastAPI app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]