mgbam commited on
Commit
ea12b30
·
verified ·
1 Parent(s): 83a3f71

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -45
Dockerfile CHANGED
@@ -1,58 +1,61 @@
1
- # ── Dockerfile for MedGenesis AI ────────────────────────────────────────
2
-
3
- # Use a lightweight Python base image
4
  FROM python:3.10-slim
5
 
6
- # Ensure stdout/stderr are not buffered, and configure Streamlit telemetry
7
- ENV PYTHONUNBUFFERED=1 \
8
- STREAMLIT_DATA_DIR=/tmp/.streamlit \
9
- XDG_STATE_HOME=/tmp \
10
- STREAMLIT_BROWSER_GATHERUSAGESTATS=false
11
-
12
- # Install system dependencies
13
  RUN apt-get update && \
14
- apt-get install -y --no-install-recommends \
15
- build-essential \
16
- curl && \
17
  rm -rf /var/lib/apt/lists/*
18
 
19
- # Pin numpy to avoid C-extension mismatches with spaCy
 
 
 
 
20
  RUN pip install --no-cache-dir numpy==1.23.5
21
 
22
- # Install Python dependencies
23
  RUN pip install --no-cache-dir \
24
  spacy==3.5.2 \
25
- transformers \
26
- huggingface-hub \
27
- scikit-learn \
28
- httpx \
29
- pandas \
30
- plotly \
31
- fpdf \
32
- streamlit \
33
- streamlit-agraph \
34
- networkx \
35
- xmltodict \
36
- feedparser \
37
- pydantic \
38
- openai \
39
- google-generativeai
40
-
41
- # Pre-download spaCy English model
42
- RUN python -m spacy download en_core_web_sm
43
-
44
- # Set working directory
45
  WORKDIR /app
46
-
47
- # Copy application code
48
  COPY . /app
49
 
50
- # Expose Streamlit default port
51
- EXPOSE 8501
 
 
52
 
53
- # Launch the Streamlit app in headless mode with debug logging
54
- CMD ["streamlit", "run", "app.py", \
55
- "--server.address=0.0.0.0", \
56
- "--server.port=8501", \
57
- "--server.headless", "true", \
58
- "--logger.level", "info"]
 
 
 
 
 
 
 
1
+ #########################
2
+ # BASE IMAGE #
3
+ #########################
4
  FROM python:3.10-slim
5
 
6
+ #########################
7
+ # OS‑LEVEL DEPENDENCIES #
8
+ #########################
 
 
 
 
9
  RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends build-essential curl && \
 
 
11
  rm -rf /var/lib/apt/lists/*
12
 
13
+ #########################
14
+ # PYTHON LAYER #
15
+ #########################
16
+ # ▸ pin NumPy before spaCy to avoid the “dtype size changed” ABI error
17
+ # (spaCy 3.5.* was compiled against NumPy 1.23) ──■
18
  RUN pip install --no-cache-dir numpy==1.23.5
19
 
20
+ # core scientific + web stack
21
  RUN pip install --no-cache-dir \
22
  spacy==3.5.2 \
23
+ transformers==4.53.0 \
24
+ huggingface-hub==0.33.1 \
25
+ scikit-learn==1.7.0 \
26
+ httpx==0.28.1 \
27
+ pandas==2.3.0 \
28
+ plotly==6.2.0 \
29
+ fpdf==1.7.2 \
30
+ streamlit==1.33.0 \
31
+ streamlit-agraph==0.0.45 \
32
+ networkx==3.4.2 \
33
+ xmltodict==0.14.2 \
34
+ feedparser==6.0.11 \
35
+ pydantic==2.11.7 \
36
+ openai==1.25.0 \
37
+ google-generativeai==0.5.4
38
+
39
+ #########################
40
+ # CODE #
41
+ #########################
 
42
  WORKDIR /app
 
 
43
  COPY . /app
44
 
45
+ #########################
46
+ # SPA‑C MODEL #
47
+ #########################
48
+ RUN python -m spacy download en_core_web_sm
49
 
50
+ #########################
51
+ # EXPOSE & START #
52
+ #########################
53
+ # Hugging Face forwards $PORT → 7860 by default. Honour that env‑var.
54
+ ENV PORT 7860
55
+ EXPOSE 7860
56
+
57
+ # Headless mode is mandatory inside a container.
58
+ CMD streamlit run app.py \
59
+ --server.headless=true \
60
+ --server.address=0.0.0.0 \
61
+ --server.port=$PORT