File size: 702 Bytes
fb80f11
0cb4281
fb80f11
 
0cb4281
fb80f11
 
 
0cb4281
fb80f11
 
0cb4281
 
fb80f11
 
0cb4281
fb80f11
 
0cb4281
fb80f11
 
0cb4281
fb80f11
 
0cb4281
fb80f11
 
0cb4281
 
fb80f11
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
29
30
31
FROM python:3.9

# Set working directory
WORKDIR /code

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

# Create a non-root user
RUN useradd user

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

# Switch to the non-root user
USER user

# Set working directory for the application
WORKDIR $HOME/app

# Copy application code into the container
COPY --chown=user . $HOME/app

# Expose port
EXPOSE 7860

# Command to run the FastAPI application using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]