Navy commited on
Commit
52c4b64
·
1 Parent(s): 297eef6

update docker

Browse files
Files changed (2) hide show
  1. Dockerfile +20 -3
  2. requirements.txt +0 -0
Dockerfile CHANGED
@@ -1,16 +1,33 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
  FROM python:3.10
5
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
 
10
  WORKDIR /app
11
 
 
12
  COPY --chown=user ./requirements.txt requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
 
15
  COPY --chown=user . /app
 
 
16
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use Python base image
 
 
2
  FROM python:3.10
3
 
4
+ # Create and switch to user
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
 
9
+ # Set work directory
10
  WORKDIR /app
11
 
12
+ # Copy requirements first for caching
13
  COPY --chown=user ./requirements.txt requirements.txt
14
+
15
+ # Install system dependencies (important for cv2)
16
+ USER root
17
+ RUN apt-get update && apt-get install -y \
18
+ libgl1 \
19
+ libglib2.0-0 \
20
+ libsm6 \
21
+ libxext6 \
22
+ libxrender1 \
23
+ && rm -rf /var/lib/apt/lists/*
24
+ USER user
25
+
26
+ # Install Python dependencies
27
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
28
 
29
+ # Copy rest of the files
30
  COPY --chown=user . /app
31
+
32
+ # Expose default Space port
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ