mgbam commited on
Commit
dad49da
·
verified ·
1 Parent(s): 2321094

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -13
Dockerfile CHANGED
@@ -1,7 +1,5 @@
1
- # Use an official lightweight Python image
2
  FROM python:3.10-slim
3
 
4
- # Prevent Python from writing .pyc files and enable unbuffered output
5
  ENV PYTHONUNBUFFERED=1 \
6
  PIP_NO_CACHE_DIR=1 \
7
  PORT=7860 \
@@ -10,27 +8,23 @@ ENV PYTHONUNBUFFERED=1 \
10
  STREAMLIT_SERVER_ENABLECORS=false \
11
  STREAMLIT_SERVER_ENABLEWEBRTC=false
12
 
13
- # Set the working directory
14
  WORKDIR /code
15
 
16
- # Install OS-level dependencies (if needed, add more as required)
17
  RUN apt-get update && \
18
  apt-get install -y --no-install-recommends \
19
  build-essential \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
- # Install Python dependencies first for efficient caching
23
  COPY requirements.txt .
24
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
 
 
 
25
 
26
- # Copy the rest of your project files
27
  COPY . .
28
 
29
- # Expose the Streamlit port
30
  EXPOSE 7860
31
 
32
- # (Optional) If you want to display Streamlit logs in real-time, you can add:
33
- ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE="poll"
34
-
35
- # Start the app
36
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
1
  FROM python:3.10-slim
2
 
 
3
  ENV PYTHONUNBUFFERED=1 \
4
  PIP_NO_CACHE_DIR=1 \
5
  PORT=7860 \
 
8
  STREAMLIT_SERVER_ENABLECORS=false \
9
  STREAMLIT_SERVER_ENABLEWEBRTC=false
10
 
 
11
  WORKDIR /code
12
 
 
13
  RUN apt-get update && \
14
  apt-get install -y --no-install-recommends \
15
  build-essential \
16
  && rm -rf /var/lib/apt/lists/*
17
 
 
18
  COPY requirements.txt .
19
+ RUN pip install --upgrade pip setuptools wheel && \
20
+ pip install -r requirements.txt
21
+
22
+ # **Install spaCy small English model during build**
23
+ RUN python -m spacy download en_core_web_sm
24
 
 
25
  COPY . .
26
 
 
27
  EXPOSE 7860
28
 
29
+ CMD ["streamlit", "run", "app.py", \
30
+ "--server.address=0.0.0.0", "--server.port=7860"]