mgbam commited on
Commit
7be04cb
·
verified ·
1 Parent(s): e82138e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -15
Dockerfile CHANGED
@@ -1,25 +1,33 @@
1
  FROM python:3.10-slim
2
 
3
- WORKDIR /code
4
 
5
- # Install system deps
6
- RUN apt-get update \
7
- && apt-get install -y --no-install-recommends build-essential gcc \
8
- && rm -rf /var/lib/apt/lists/*
 
 
 
9
 
10
- # Copy requirements and install
11
  COPY requirements.txt .
 
 
12
 
13
- # First install NumPy alone to get the right ABI
14
- RUN pip install --no-cache-dir numpy==1.24.4
15
 
16
- # Now install everything else
17
- RUN pip install --upgrade pip setuptools wheel \
18
- && pip install --no-cache-dir -r requirements.txt
19
 
20
- # Finally download the spaCy model
21
- RUN python -m spacy download en_core_web_sm
 
22
 
23
- COPY . .
 
 
24
 
25
- CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]
 
 
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"]