NavyDevilDoc commited on
Commit
d879271
·
verified ·
1 Parent(s): c489994

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -32
Dockerfile CHANGED
@@ -3,52 +3,41 @@ FROM python:3.10-slim
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
- pkg-config \
25
  curl \
26
  git \
27
  tesseract-ocr \
28
  poppler-utils \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
- # 3. Install Python Libraries
32
- # We separate llama-cpp-python to ensure it builds with the flags set above
33
  COPY requirements.txt .
 
34
 
35
- RUN pip3 install --no-cache-dir --upgrade pip && \
36
- pip3 install --no-cache-dir llama-cpp-python && \
37
- pip3 install --no-cache-dir -r requirements.txt
38
 
39
- # 4. Download NLP Models (Spacy/NLTK)
40
- RUN python3 -m spacy download en_core_web_sm
41
- RUN python3 -m nltk.downloader stopwords wordnet omw-1.4
42
-
43
- # 5. Copy Application Code
44
  COPY . .
45
 
46
- # 6. Global Permissions Fix
47
- # Ensures write access for user data/uploads
48
  RUN chmod -R 777 /app
49
 
50
- # 7. Expose the port
 
 
 
 
 
 
51
  EXPOSE 7860
52
 
53
- # 8. Start the App
54
- 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. 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"]