codedawakening commited on
Commit
a8d0ffd
·
verified ·
1 Parent(s): 89e2124

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -20
Dockerfile CHANGED
@@ -1,43 +1,57 @@
1
- # Use Python slim image for smaller size
2
- FROM python:3.10-slim
3
-
4
- # Install minimal system dependencies
5
- RUN apt-get update && apt-get install -y \
6
- wget \
 
 
 
 
 
 
 
7
  curl \
 
 
 
 
 
 
8
  poppler-utils \
9
  tesseract-ocr \
10
- libgl1-mesa-glx \
11
- libsm6 \
12
- libxext6 \
13
- libxrender-dev \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
  WORKDIR /app
17
 
18
  # Copy requirements first for better caching
19
  COPY requirements.txt .
20
- RUN pip install --no-cache-dir --upgrade pip && \
21
- pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copy all other files
 
 
 
24
  COPY . .
25
 
26
  # Create necessary directories
27
- RUN mkdir -p uploads logs
28
-
29
- # Expose port (Hugging Face uses 7860)
30
- EXPOSE 7860
31
 
32
  # Set environment variables
33
  ENV PYTHONUNBUFFERED=1
 
34
  ENV STREAMLIT_SERVER_PORT=7860
35
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
36
- ENV STREAMLIT_SERVER_HEADLESS=true
37
 
38
- # Run Streamlit app
 
 
 
39
  CMD ["streamlit", "run", "app.py", \
40
  "--server.port=7860", \
41
  "--server.address=0.0.0.0", \
42
  "--server.headless=true", \
43
- "--browser.gatherUsageStats=false"]
 
 
 
1
+ # Use Ubuntu base for better compatibility
2
+ FROM ubuntu:22.04
3
+
4
+ # Set environment variables to avoid interactive prompts
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV TZ=UTC
7
+
8
+ # Install Python and essential dependencies
9
+ RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends \
11
+ python3.10 \
12
+ python3-pip \
13
+ python3.10-venv \
14
  curl \
15
+ wget \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Install PDF processing dependencies
19
+ RUN apt-get update && \
20
+ apt-get install -y --no-install-recommends \
21
  poppler-utils \
22
  tesseract-ocr \
 
 
 
 
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
  WORKDIR /app
26
 
27
  # Copy requirements first for better caching
28
  COPY requirements.txt .
29
+ RUN pip3 install --no-cache-dir --upgrade pip && \
30
+ pip3 install --no-cache-dir -r requirements.txt
31
 
32
+ # Download embedding model (small version)
33
+ RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
34
+
35
+ # Copy application code
36
  COPY . .
37
 
38
  # Create necessary directories
39
+ RUN mkdir -p data/documents data/chroma_db data/uploads logs
 
 
 
40
 
41
  # Set environment variables
42
  ENV PYTHONUNBUFFERED=1
43
+ ENV PYTHONPATH=/app
44
  ENV STREAMLIT_SERVER_PORT=7860
45
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
 
46
 
47
+ # Expose port
48
+ EXPOSE 7860
49
+
50
+ # Run the application
51
  CMD ["streamlit", "run", "app.py", \
52
  "--server.port=7860", \
53
  "--server.address=0.0.0.0", \
54
  "--server.headless=true", \
55
+ "--browser.gatherUsageStats=false", \
56
+ "--server.enableXsrfProtection=false", \
57
+ "--server.enableCORS=false"]