Muhammad Ahad Hassan Khan commited on
Commit
d1f5a62
·
1 Parent(s): 7b7e706

changed docker file 2

Browse files
Files changed (1) hide show
  1. dockerfile +7 -5
dockerfile CHANGED
@@ -1,5 +1,9 @@
1
  FROM python:3.10
2
 
 
 
 
 
3
  # Avoid interactive prompts
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
@@ -15,11 +19,9 @@ RUN apt-get update && apt-get install -y \
15
  WORKDIR /app
16
 
17
  # Install Python packages
18
- COPY requirements.txt .
19
- RUN pip install --upgrade pip && pip install -r requirements.txt
20
 
21
  # Copy all files
22
- COPY . .
23
-
24
- # Launch FastAPI app with Uvicorn
25
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10
2
 
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
  # Avoid interactive prompts
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
 
19
  WORKDIR /app
20
 
21
  # Install Python packages
22
+ COPY --chown=user ./requirements.txt requirements.txt
23
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
24
 
25
  # Copy all files
26
+ COPY --chown=user . .
 
 
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]