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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -36
Dockerfile CHANGED
@@ -1,58 +1,43 @@
1
- # Use Ubuntu with Python for Ollama compatibility
2
- FROM ubuntu:22.04
3
 
4
- # Prevent interactive prompts during apt-get
5
- ENV DEBIAN_FRONTEND=noninteractive
6
- ENV TZ=Etc/UTC
7
-
8
- # Install system dependencies
9
  RUN apt-get update && apt-get install -y \
10
- python3.10 \
11
- python3-pip \
12
- python3.10-venv \
13
- curl \
14
  wget \
15
- git \
16
- build-essential \
17
  poppler-utils \
18
  tesseract-ocr \
19
  libgl1-mesa-glx \
20
- libglib2.0-0 \
21
  libsm6 \
22
  libxext6 \
23
  libxrender-dev \
24
- libssl-dev \
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
- # Install Ollama
28
- RUN curl -fsSL https://ollama.ai/install.sh | sh
29
-
30
  WORKDIR /app
31
 
32
  # Copy requirements first for better caching
33
  COPY requirements.txt .
34
- RUN pip3 install --no-cache-dir --upgrade pip && \
35
- pip3 install --no-cache-dir -r requirements.txt
36
 
37
- # Download embedding model (pre-download to avoid timeout)
38
- RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('paraphrase-MiniLM-L3-v2')"
39
-
40
- # Copy application code
41
  COPY . .
42
 
43
  # Create necessary directories
44
- RUN mkdir -p chroma_db uploads logs models
45
 
46
- # Expose ports (Streamlit uses 8501, but HF Spaces uses 7860)
47
  EXPOSE 7860
48
- EXPOSE 8501
49
-
50
- # Health check
51
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
52
- CMD curl -f http://localhost:7860/ || exit 1
53
-
54
- # Start script
55
- COPY start.sh .
56
- RUN chmod +x start.sh
57
 
58
- CMD ["./start.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
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"]