mike23415 commited on
Commit
feea28d
·
verified ·
1 Parent(s): 98ee9d3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -5
Dockerfile CHANGED
@@ -1,10 +1,11 @@
1
  FROM python:3.9-slim
2
 
3
- # System dependencies with numpy build requirements
4
  RUN apt-get update && apt-get install -y \
5
  git \
6
  gcc \
7
  g++ \
 
8
  libopenblas-dev \
9
  python3-dev \
10
  && rm -rf /var/lib/apt/lists/*
@@ -19,11 +20,13 @@ ENV TRANSFORMERS_CACHE=/app/cache \
19
  HF_HOME=/app/cache \
20
  PYTHONWARNINGS="ignore" \
21
  NPY_NO_DEPRECATED_API=1 \
22
- XDG_CACHE_HOME=/app/cache
 
 
23
 
24
  COPY requirements.txt .
25
 
26
- # Install with numpy first
27
  RUN pip install --no-cache-dir --upgrade pip && \
28
  pip install --no-cache-dir numpy==1.26.4 && \
29
  pip install --no-cache-dir -r requirements.txt
@@ -32,8 +35,9 @@ COPY app.py .
32
 
33
  EXPOSE 5000
34
 
35
- # Add a healthcheck to monitor application status
36
  HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
37
  CMD curl -f http://localhost:5000/health || exit 1
38
 
39
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "600", "app:app"]
 
 
1
  FROM python:3.9-slim
2
 
3
+ # System dependencies
4
  RUN apt-get update && apt-get install -y \
5
  git \
6
  gcc \
7
  g++ \
8
+ curl \
9
  libopenblas-dev \
10
  python3-dev \
11
  && rm -rf /var/lib/apt/lists/*
 
20
  HF_HOME=/app/cache \
21
  PYTHONWARNINGS="ignore" \
22
  NPY_NO_DEPRECATED_API=1 \
23
+ XDG_CACHE_HOME=/app/cache \
24
+ PRELOAD_MODEL=false \
25
+ TOKENIZERS_PARALLELISM=false
26
 
27
  COPY requirements.txt .
28
 
29
+ # Install Python deps in order (numpy first)
30
  RUN pip install --no-cache-dir --upgrade pip && \
31
  pip install --no-cache-dir numpy==1.26.4 && \
32
  pip install --no-cache-dir -r requirements.txt
 
35
 
36
  EXPOSE 5000
37
 
38
+ # Healthcheck
39
  HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
40
  CMD curl -f http://localhost:5000/health || exit 1
41
 
42
+ # Use a single worker to reduce memory pressure
43
+ CMD ["gunicorn", "app:app", "--workers=1", "--threads=1", "--timeout=300", "--bind=0.0.0.0:5000"]