File size: 661 Bytes
89e2590
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.8.18

WORKDIR /

# Copy requirements.txt to the container
COPY requirements.txt ./

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Add a non-root user to run the application
RUN useradd -m -u 1000 user

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

# Create the application directory
WORKDIR $HOME/app

# Copy the application code and model files
COPY --chown=user . $HOME/app/

# Expose the port the FastAPI app runs on
EXPOSE 7860

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