File size: 567 Bytes
5c19521
 
 
 
 
 
f526f28
 
5c19521
f526f28
 
5c19521
f526f28
 
5c19521
 
f526f28
5c19521
 
 
 
 
 
 
f526f28
3b3454e
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
FROM python:3.10

WORKDIR /code

COPY ./requirements.txt /code/requirements.txt

# Upgrade pip before installing requirements
RUN pip install --no-cache-dir --upgrade pip

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

# Create and use non-root user
RUN useradd -m user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:${PATH}

WORKDIR $HOME/app

COPY --chown=user . $HOME/app

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