mike23415 commited on
Commit
d07bca2
·
verified ·
1 Parent(s): 007545e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -3
Dockerfile CHANGED
@@ -4,13 +4,19 @@ FROM python:3.9-slim
4
  RUN apt-get update && apt-get install -y \
5
  libgl1 \
6
  libglib2.0-0 \
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
  WORKDIR /app
10
 
11
- # Set environment variables for Numba
12
  ENV NUMBA_CACHE_DIR=/tmp/numba_cache \
13
- NUMBA_DISABLE_CACHE=1
 
 
 
 
 
14
 
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
@@ -18,4 +24,5 @@ RUN pip install --no-cache-dir -r requirements.txt
18
  COPY app.py .
19
 
20
  EXPOSE 5000
21
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "120", "app:app"]
 
 
4
  RUN apt-get update && apt-get install -y \
5
  libgl1 \
6
  libglib2.0-0 \
7
+ wget \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
  WORKDIR /app
11
 
12
+ # Set environment variables
13
  ENV NUMBA_CACHE_DIR=/tmp/numba_cache \
14
+ NUMBA_DISABLE_CACHE=1 \
15
+ U2NET_HOME=/app/models
16
+
17
+ # Pre-download model during build
18
+ RUN mkdir -p /app/models \
19
+ && wget https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx -P /app/models
20
 
21
  COPY requirements.txt .
22
  RUN pip install --no-cache-dir -r requirements.txt
 
24
  COPY app.py .
25
 
26
  EXPOSE 5000
27
+ # Increase timeout to 5 minutes (300 seconds)
28
+ CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "300", "--preload", "app:app"]