ayush2917 commited on
Commit
8bffe20
·
verified ·
1 Parent(s): bd5916f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -1
Dockerfile CHANGED
@@ -6,11 +6,15 @@ WORKDIR /app
6
  ENV PYTHONDONTWRITEBYTECODE 1
7
  ENV PYTHONUNBUFFERED 1
8
  ENV HUGGINGFACE_API_TOKEN=${HUGGINGFACE_API_TOKEN}
 
 
9
 
10
  # Install system dependencies
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  build-essential \
13
  curl \
 
 
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
  # Copy requirements first to leverage Docker cache
@@ -20,6 +24,11 @@ COPY requirements.txt .
20
  RUN pip install --no-cache-dir --upgrade pip \
21
  && pip install --no-cache-dir -r requirements.txt
22
 
 
 
 
 
 
23
  # Copy application code
24
  COPY . .
25
 
@@ -30,7 +39,7 @@ RUN mkdir -p static/audio static/assets
30
  EXPOSE 7860
31
 
32
  # Run Gunicorn with optimized settings
33
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--threads", "4", "--timeout", "120", "app:app"]
34
 
35
  # Healthcheck
36
  HEALTHCHECK --interval=30s --timeout=3s \
 
6
  ENV PYTHONDONTWRITEBYTECODE 1
7
  ENV PYTHONUNBUFFERED 1
8
  ENV HUGGINGFACE_API_TOKEN=${HUGGINGFACE_API_TOKEN}
9
+ ENV TRANSFORMERS_CACHE=/tmp/cache
10
+ ENV HF_HOME=/tmp/cache
11
 
12
  # Install system dependencies
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
  build-essential \
15
  curl \
16
+ && mkdir -p /tmp/cache \
17
+ && chmod 777 /tmp/cache \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
  # Copy requirements first to leverage Docker cache
 
24
  RUN pip install --no-cache-dir --upgrade pip \
25
  && pip install --no-cache-dir -r requirements.txt
26
 
27
+ # Create cache directory and dummy embeddings file if needed
28
+ RUN mkdir -p /app/cache \
29
+ && touch /app/embeddings_cache.joblib \
30
+ && chmod 777 /app/embeddings_cache.joblib
31
+
32
  # Copy application code
33
  COPY . .
34
 
 
39
  EXPOSE 7860
40
 
41
  # Run Gunicorn with optimized settings
42
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "120", "app:app"]
43
 
44
  # Healthcheck
45
  HEALTHCHECK --interval=30s --timeout=3s \