agentsay commited on
Commit
87c85da
·
verified ·
1 Parent(s): 6782e56

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -13
Dockerfile CHANGED
@@ -1,13 +1,28 @@
1
- FROM python:3.9
2
-
3
- RUN useradd -m -u 1000 user
4
- USER user
5
- ENV PATH="/home/user/.local/bin:$PATH"
6
-
7
- WORKDIR /app
8
-
9
- COPY --chown=user ./requirements.txt requirements.txt
10
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
-
12
- COPY --chown=user . /app
13
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies for OpenCV and other required libraries
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ libgl1 \
9
+ libglib2.0-0 \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Create Uploads, cache, and models directories with writable permissions
13
+ RUN mkdir -p /app/Uploads /app/cache /app/models && chmod -R 777 /app/Uploads /app/cache /app/models
14
+
15
+ # Set HF_HOME for huggingface_hub cache
16
+ ENV HF_HOME=/app/cache
17
+
18
+ # Copy all files and folders from the project root to /app
19
+ COPY . .
20
+
21
+ RUN pip install python-multipart
22
+
23
+ # Install Python dependencies from requirements.txt
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Expose the port for Hugging Face Spaces
27
+ EXPOSE 7860
28
+ CMD ["python", "app.py"]