File size: 713 Bytes
646309f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.11 as the base image
FROM python:3.11

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

# Switch to the non-root user
USER user

# Set the environment PATH to include user's local bin
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory
WORKDIR /app

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

# Copy the application files to the working directory
COPY --chown=user . /app

# Expose the port that the application will run on
EXPOSE 7860

# Start the FastAPI application using uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]