andevs commited on
Commit
1da8dca
·
verified ·
1 Parent(s): 606a135

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -20
Dockerfile CHANGED
@@ -1,37 +1,23 @@
1
  FROM python:3.10-slim
2
 
3
- # Install system dependencies for OpenCV and rembg
4
  RUN apt-get update && apt-get install -y \
5
- wget \
6
- curl \
7
  libgl1-mesa-glx \
8
  libglib2.0-0 \
9
- libsm6 \
10
- libxext6 \
11
- libxrender-dev \
12
- libgomp1 \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Create cache directory for models
16
- RUN mkdir -p /tmp/.u2net
17
-
18
  WORKDIR /app
19
 
20
- # Copy requirements first for better caching
21
  COPY requirements.txt .
22
-
23
- # Install Python dependencies
24
  RUN pip install --no-cache-dir --upgrade pip && \
25
  pip install --no-cache-dir -r requirements.txt
26
 
27
- # Copy application code
28
- COPY . .
29
-
30
- # Pre-download model during build (optional)
31
- RUN python -c "from rembg import new_session; new_session('u2netp')" || echo "Model download may happen at runtime"
32
 
33
  # Expose port
34
  EXPOSE 7860
35
 
36
- # Run the app
37
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "300"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
 
 
5
  libgl1-mesa-glx \
6
  libglib2.0-0 \
 
 
 
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
 
 
 
9
  WORKDIR /app
10
 
11
+ # Copy requirements first
12
  COPY requirements.txt .
 
 
13
  RUN pip install --no-cache-dir --upgrade pip && \
14
  pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Copy app
17
+ COPY app.py .
 
 
 
18
 
19
  # Expose port
20
  EXPOSE 7860
21
 
22
+ # Start the server - THIS IS THE KEY LINE
23
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]