mike23415 commited on
Commit
b5e4830
·
verified ·
1 Parent(s): 953a50c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -34
Dockerfile CHANGED
@@ -1,43 +1,22 @@
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/*
12
 
13
- # Create cache directory
14
- RUN mkdir -p /app/cache && chmod 777 /app/cache
15
-
16
- WORKDIR /app
17
-
18
- # Environment variables
19
- ENV TRANSFORMERS_CACHE=/app/cache \
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
33
-
34
- COPY app.py .
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"]
 
1
+ FROM python:3.10-slim
2
 
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
  git \
 
 
 
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy requirements first for better caching
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Copy the rest of the application
16
+ COPY . .
 
 
 
 
 
 
17
 
18
+ # Expose the port the app runs on
19
+ EXPOSE 7860
 
20
 
21
+ # Command to run the application
22
+ CMD ["python", "app.py"]