File size: 847 Bytes
e800c46
 
6ef5e2a
 
e800c46
6ef5e2a
bd1046f
 
408a29c
6ef5e2a
 
e800c46
6ef5e2a
 
 
e800c46
6ef5e2a
e800c46
1455995
bd1046f
1455995
 
6ef5e2a
 
 
e800c46
6ef5e2a
 
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
FROM python:3.9

# Create a new user and group with UID/GID 1000
RUN groupadd -r myapp && useradd -r -g myapp -u 1000 myapp

# Create the working directory and set the ownership to the new user and group
RUN mkdir /app && chown myapp:myapp /app
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y libgl1 ffmpeg libsm6 libxext6

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the code and set the ownership to the new user and group
COPY . .
RUN chown -R myapp:myapp .

# Create the home directory for the myapp user
RUN mkdir /home/myapp && chown myapp:myapp /home/myapp && chmod a+rwx /home/myapp

# Switch to the new user
USER myapp

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