File size: 782 Bytes
89040ed
 
63bdccf
 
 
89040ed
63bdccf
89040ed
63bdccf
6f6295e
 
 
63bdccf
89040ed
63bdccf
89040ed
63bdccf
89040ed
 
63bdccf
6f6295e
63bdccf
 
 
 
89040ed
63bdccf
89040ed
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
FROM python:3.10.11

# Install dependencies from requirements.txt
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && rm /tmp/requirements.txt

# Create a non-root user with a home directory
RUN useradd -m -u 1000 user

# Switch to the non-root user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set working directory to the home directory of the user
WORKDIR $HOME/app

# Copy the application code and set the correct permissions
COPY --chown=user . $HOME/app


# Expose the port that the FastAPI app will run on
EXPOSE 7860

# Start the FastAPI app on port 7860, the default port expected by Hugging Face Spaces
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]