File size: 639 Bytes
2a84959
 
 
 
 
4670177
 
 
 
2a84959
 
 
 
 
 
 
4670177
2a84959
 
4670177
2a84959
 
4670177
2a84959
 
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
# Use Python 3.9 image as the base
FROM python:3.9

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

# Set the working directory
WORKDIR /app

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

# Copy the entire application code into the working directory
COPY . /app/

# Expose the port that Uvicorn will use
EXPOSE 8000

# Switch to the non-root user
USER user

# Run the main program with Uvicorn (adjust path to match your actual app structure)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]