mgbam commited on
Commit
f75e371
·
verified ·
1 Parent(s): bc178da

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -23
Dockerfile CHANGED
@@ -1,33 +1,38 @@
1
  FROM python:3.10-slim
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies + Streamlit requirements
6
- RUN apt-get update && \
7
- apt-get install -y --no-install-recommends \
8
- build-essential \
9
- gcc \
10
- libgomp1 \
11
- && rm -rf /var/lib/apt/lists/*
12
 
13
- # Install Python dependencies first for caching
14
- COPY requirements.txt .
15
- RUN pip install --upgrade pip && \
16
- pip install --no-cache-dir -r requirements.txt
17
 
18
- # Verify Streamlit installation
19
- RUN which streamlit && streamlit --version
20
 
21
- # Copy application files
22
- COPY . .
23
 
24
- # Set up non-root user
25
- RUN useradd -m appuser && chown -R appuser:appuser /app
26
- USER appuser
27
 
28
- # Health check (optional but recommended)
29
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
30
- CMD curl -f http://localhost:7860/health || exit 1
31
 
32
- # Run Streamlit
33
- CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ Set environment variables
4
+
5
+ ENV PYTHONUNBUFFERED=1 STREAMLIT_DATA_DIR=/tmp/.streamlit XDG_STATE_HOME=/tmp STREAMLIT_BROWSER_GATHERUSAGESTATS=false
6
+
7
+ Install OS-level dependencies
8
+
9
+ RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl && rm -rf /var/lib/apt/lists/*
10
+
11
+ Pin numpy to avoid binary incompatibility issues
12
+
13
+ RUN pip install --no-cache-dir numpy==1.23.5
14
+
15
+ Install Python dependencies
16
+
17
+ RUN pip install --no-cache-dir spacy==3.5.2 httpx pandas plotly fpdf streamlit streamlit-agraph networkx xmltodict feedparser pydantic openai google-generative-ai
18
+
19
+ Download the spaCy small English model
20
+
21
+ RUN python -m spacy download en_core_web_sm
22
+
23
+ Set working directory
24
+
25
  WORKDIR /app
26
 
27
+ Copy application code
 
 
 
 
 
 
28
 
29
+ COPY . /app
 
 
 
30
 
31
+ Expose Streamlit port
 
32
 
33
+ EXPOSE 8501
 
34
 
35
+ Default command
 
 
36
 
37
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=8501"]
 
 
38