Abdullahcoder54 commited on
Commit
b8d8dcf
·
1 Parent(s): 36425a4
Files changed (1) hide show
  1. Dockerfile +8 -8
Dockerfile CHANGED
@@ -1,20 +1,20 @@
1
-
2
  FROM python:3.10
3
 
4
- # Pehle root user hai by default, to yahan packages install karo
5
  RUN apt-get update && apt-get install -y libgl1 libglib2.0-0
6
 
7
- # Ab user add karo aur switch karo
8
  RUN useradd -m -u 1000 user
9
- USER user
10
- ENV PATH="/home/user/.local/bin:$PATH"
11
 
12
  WORKDIR /app
13
 
14
-
15
- COPY --chown=user ./requirements.txt requirements.txt
16
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
 
 
 
 
 
18
 
19
- COPY --chown=user . /app
20
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10
2
 
 
3
  RUN apt-get update && apt-get install -y libgl1 libglib2.0-0
4
 
5
+ # Create user but stay root during install
6
  RUN useradd -m -u 1000 user
 
 
7
 
8
  WORKDIR /app
9
 
10
+ # Install dependencies as root
11
+ COPY requirements.txt .
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Copy app AFTER installing dependencies
15
+ COPY . /app
16
+
17
+ # Switch to non-root user for safety
18
+ USER user
19
 
 
20
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]