NavyDevilDoc commited on
Commit
7954606
·
verified ·
1 Parent(s): 0fcbcc0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -20
Dockerfile CHANGED
@@ -3,41 +3,51 @@ FROM python:3.10-slim
3
  # Set working directory to /app
4
  WORKDIR /app
5
 
6
- # 1. Install System Dependencies
 
 
 
 
 
 
 
 
 
 
 
 
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
 
 
 
9
  curl \
10
  git \
11
  tesseract-ocr \
12
  poppler-utils \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # 2. Install Python Libraries
16
- # Copy requirements from root (since it's not in src)
17
  COPY requirements.txt .
18
- RUN pip3 install --no-cache-dir -r requirements.txt
19
 
20
- # 3. Download NLP Models
21
- RUN python -m spacy download en_core_web_sm
22
- RUN python -m nltk.downloader stopwords wordnet omw-1.4
23
 
24
- # 4. Copy Application Code
25
- # This copies the 'src' folder and everything else into /app
 
 
 
26
  COPY . .
27
 
28
- # 5. Global Permissions Fix
29
- # This ensures HF user has write access to /app/src/chroma_db if it gets created there
30
  RUN chmod -R 777 /app
31
 
32
- # 6. CONFIGURATION
33
- # Force Streamlit to use the correct port
34
- ENV STREAMLIT_SERVER_PORT=7860
35
- ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
36
- ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none
37
-
38
- # Expose the port
39
  EXPOSE 7860
40
 
41
- # 7. Start the App
42
- # CRITICAL FIX: We tell Streamlit to run the file inside the 'src' folder
43
  ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
 
3
  # Set working directory to /app
4
  WORKDIR /app
5
 
6
+ # 1. Set Environment Variables for Llama Build
7
+ # This forces the installer to compile from source with OpenBLAS (CPU speed boost)
8
+ ENV PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1 \
10
+ CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_OPENBLAS=ON" \
11
+ FORCE_CMAKE=1 \
12
+ STREAMLIT_SERVER_PORT=7860 \
13
+ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
14
+ STREAMLIT_SERVER_FILE_WATCHER_TYPE=none
15
+
16
+ # 2. Install System Dependencies (Merged)
17
+ # Added: cmake, g++, libopenblas-dev (For Llama)
18
+ # Kept: tesseract-ocr, poppler-utils (For your document tools)
19
  RUN apt-get update && apt-get install -y \
20
  build-essential \
21
+ cmake \
22
+ g++ \
23
+ libopenblas-dev \
24
  curl \
25
  git \
26
  tesseract-ocr \
27
  poppler-utils \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
+ # 3. Install Python Libraries
31
+ # We separate llama-cpp-python to ensure it builds with the flags set above
32
  COPY requirements.txt .
 
33
 
34
+ RUN pip3 install --no-cache-dir --upgrade pip && \
35
+ pip3 install --no-cache-dir llama-cpp-python && \
36
+ pip3 install --no-cache-dir -r requirements.txt
37
 
38
+ # 4. Download NLP Models (Spacy/NLTK)
39
+ RUN python3 -m spacy download en_core_web_sm
40
+ RUN python3 -m nltk.downloader stopwords wordnet omw-1.4
41
+
42
+ # 5. Copy Application Code
43
  COPY . .
44
 
45
+ # 6. Global Permissions Fix
46
+ # Ensures write access for user data/uploads
47
  RUN chmod -R 777 /app
48
 
49
+ # 7. Expose the port
 
 
 
 
 
 
50
  EXPOSE 7860
51
 
52
+ # 8. Start the App
 
53
  ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]