File size: 509 Bytes
a1dd175
 
 
 
 
 
 
 
 
 
b1eaaf5
 
a1dd175
 
b1eaaf5
 
 
 
a1dd175
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Use a lightweight Python image
FROM python:3.9

# Create a non-root user
RUN useradd -u 1000 user
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory inside the container
WORKDIR /app

# Copy the dependencies and install them as root
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Switch to the non-root user after installing dependencies
USER user
COPY . .

# Run the FastAPI app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]