saniaE commited on
Commit
8d0c01b
·
1 Parent(s): e1aa346

updated docker

Browse files
Files changed (1) hide show
  1. dockerfile +21 -5
dockerfile CHANGED
@@ -1,10 +1,26 @@
1
- FROM python:3.10-slim
2
 
3
- WORKDIR /app
 
 
 
 
4
 
5
- COPY ./requirements.txt /app/requirements.txt
6
- RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
7
 
8
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.10-slim
2
 
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ build-essential \
6
+ libgl1-mesa-glx \
7
+ && rm -rf /var/lib/apt/lists/*
8
 
9
+ # Set up a new user named "user" with user ID 1000
10
+ RUN useradd -m -u 1000 user
11
 
12
+ # Switch to the new user
13
+ USER user
14
+
15
+ # Set environment variables
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
+
19
+ WORKDIR $HOME/app
20
+
21
+ COPY --chown=user requirements.txt .
22
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
23
+
24
+ COPY --chown=user . .
25
 
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]