File size: 744 Bytes
46280a7
f639e70
c21db68
f639e70
 
 
 
c21db68
f639e70
 
c21db68
f639e70
 
 
c21db68
f639e70
c21db68
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM python:3.10

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory
WORKDIR /app

# Copy requirements first to leverage Docker cache
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application
COPY --chown=user . /app

# Create the models directory explicitly to ensure it exists and is writable
# (Your python script needs this to download the models at runtime)
RUN mkdir -p /app/models

# Start the application
# CHANGED: "app:app" -> "main:app" because your file is named main.py
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]