LahiruD95 commited on
Commit
4d84d28
Β·
1 Parent(s): f4aa29b

Chnaged requirement text

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -26
Dockerfile CHANGED
@@ -1,46 +1,32 @@
1
- # ───────────────────────────────────────────────
2
- # MindPalace AI – Hugging Face Spaces (Docker)
3
- # ───────────────────────────────────────────────
4
- # β€’ CPU-only base image with Python 3.11
5
- # β€’ Installs system libs (tesseract, ffmpeg) needed by OCR / audio
6
- # β€’ Installs Python dependencies from requirements.txt
7
- # β€’ Runs Gunicorn with gevent workers on HF-required port 7860
8
- # β€’ Space URL will be: https://<handle>-MindPalaceAI.hf.space
9
- # ───────────────────────────────────────────────
10
-
11
  FROM python:3.11-slim
12
 
13
- # 1️⃣ Install system packages (add more as you need)
14
  RUN apt-get update && \
15
  apt-get install -y --no-install-recommends \
16
- tesseract-ocr \
17
- libgl1 \
18
- ffmpeg && \
19
  rm -rf /var/lib/apt/lists/*
20
 
21
- # 2️⃣ Set work directory
22
  WORKDIR /app
23
 
24
- # 2️⃣.b Ensure /data cache directory exists and is writable (HF Spaces persistent volume)
25
- RUN mkdir -p /data/.cache/huggingface && chmod -R 777 /data/.cache
 
 
26
 
27
- # 3️⃣ Copy & install Python deps first (layer cache)
28
  COPY requirements.txt .
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
- # 4️⃣ Copy the rest of the application code
32
  COPY . .
33
 
34
- # 5️⃣ Hugging Face automatically sets $PORT=7860
35
- ENV PORT=7860
36
-
37
- # put near the other ENV lines
38
- ENV XDG_CACHE_HOME=/data/.cache \
39
  TRANSFORMERS_CACHE=/data/.cache/huggingface \
40
  HF_HOME=/data/.cache/huggingface \
41
  EASYOCR_MODEL_STORAGE=/data/.EasyOCR
42
 
43
  EXPOSE ${PORT}
44
 
45
- # 6️⃣ Start the server
46
- CMD gunicorn wsgi:app -k gevent --timeout 300 --bind 0.0.0.0:$PORT
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.11-slim
2
 
3
+ # install system deps…
4
  RUN apt-get update && \
5
  apt-get install -y --no-install-recommends \
6
+ tesseract-ocr \
7
+ libgl1 \
8
+ ffmpeg && \
9
  rm -rf /var/lib/apt/lists/*
10
 
 
11
  WORKDIR /app
12
 
13
+ # create both cache dirs and make them world-writable
14
+ RUN mkdir -p /data/.cache/huggingface && \
15
+ mkdir -p /data/.EasyOCR && \
16
+ chmod -R 777 /data/.cache /data/.EasyOCR
17
 
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
 
21
  COPY . .
22
 
23
+ # tell HF and EasyOCR to use those
24
+ ENV PORT=7860 \
25
+ XDG_CACHE_HOME=/data/.cache \
 
 
26
  TRANSFORMERS_CACHE=/data/.cache/huggingface \
27
  HF_HOME=/data/.cache/huggingface \
28
  EASYOCR_MODEL_STORAGE=/data/.EasyOCR
29
 
30
  EXPOSE ${PORT}
31
 
32
+ CMD gunicorn wsgi:app -k gevent --timeout 300 --bind 0.0.0.0:$PORT