Hussein El-Hadidy commited on
Commit
23f86bb
·
1 Parent(s): 8a2129b

Upgraded Pip

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -1
Dockerfile CHANGED
@@ -1,5 +1,7 @@
 
1
  FROM python:3.10
2
 
 
3
  RUN apt-get update && \
4
  apt-get install -y \
5
  build-essential \
@@ -8,15 +10,25 @@ RUN apt-get update && \
8
  libgl1 \
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
11
  RUN useradd -m -u 1000 user
12
  USER user
 
 
13
  ENV PATH="/home/user/.local/bin:$PATH"
14
 
 
15
  WORKDIR /app
16
 
 
17
  COPY --chown=user ./requirements.txt requirements.txt
18
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
 
 
 
 
 
 
20
  COPY --chown=user . /app
21
 
 
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the correct Python version (3.10)
2
  FROM python:3.10
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && \
6
  apt-get install -y \
7
  build-essential \
 
10
  libgl1 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Create a user for non-root operation
14
  RUN useradd -m -u 1000 user
15
  USER user
16
+
17
+ # Set the PATH to the user’s local bin directory
18
  ENV PATH="/home/user/.local/bin:$PATH"
19
 
20
+ # Set the working directory to /app
21
  WORKDIR /app
22
 
23
+ # Copy the requirements.txt and install Python dependencies
24
  COPY --chown=user ./requirements.txt requirements.txt
 
25
 
26
+ # Ensure pip is up-to-date before installing requirements
27
+ RUN pip install --no-cache-dir --upgrade pip && \
28
+ pip install --no-cache-dir --upgrade -r requirements.txt
29
+
30
+ # Copy the rest of the application code
31
  COPY --chown=user . /app
32
 
33
+ # Expose the port and run the app with Uvicorn
34
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]