NeonSamurai commited on
Commit
b2f74d5
·
verified ·
1 Parent(s): bc6018a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -25
Dockerfile CHANGED
@@ -1,36 +1,37 @@
1
- FROM python:3.13.5-slim
 
2
 
 
3
  WORKDIR /app
4
 
5
- # Install OS dependencies
6
- RUN apt-get update && apt-get install -y \
7
- build-essential \
8
- curl \
9
- git \
10
- && rm -rf /var/lib/apt/lists/*
11
 
12
- # Copy requirements first to leverage caching
13
- COPY requirements.txt ./
14
- RUN pip3 install --no-cache-dir -r requirements.txt
 
15
 
16
- # Copy all app files
17
- COPY . .
18
 
19
- # Make sure cache & Streamlit folders exist and are writable
20
- RUN mkdir -p /app/.cache /app/.streamlit \
21
- && chmod -R 777 /app/.cache /app/.streamlit
22
 
23
- # Set environment variables for caches
24
- ENV STREAMLIT_HOME=/app/.streamlit
25
- ENV TRANSFORMERS_CACHE=/app/.cache
26
- ENV HF_HOME=/app/.cache
27
- ENV XDG_CACHE_HOME=/app/.cache
28
 
29
- # Expose the Streamlit port
30
  EXPOSE 8501
31
 
32
- # Healthcheck (optional)
33
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
 
34
 
35
- # Run your app
36
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # Use official Python 3.13 slim image
2
+ FROM python:3.13-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Set environment variables for cache and Streamlit
8
+ ENV TRANSFORMERS_CACHE=/app/.cache
9
+ ENV HF_HOME=/app/.cache
10
+ ENV XDG_CACHE_HOME=/app/.cache
11
+ ENV STREAMLIT_HOME=/app/.streamlit
12
+ ENV PYTHONUNBUFFERED=1
13
 
14
+ # Create writable directories for cache and vector DBs
15
+ RUN mkdir -p /app/.cache/huggingface \
16
+ && mkdir -p /app/.streamlit \
17
+ && mkdir -p /app/vectordb
18
 
19
+ # Copy only requirements first (for caching in Docker build)
20
+ COPY requirements.txt .
21
 
22
+ # Upgrade pip and install dependencies
23
+ RUN pip install --no-cache-dir --upgrade pip \
24
+ && pip install --no-cache-dir -r requirements.txt
25
 
26
+ # Copy the rest of your app
27
+ COPY . .
 
 
 
28
 
29
+ # Expose the default Streamlit port
30
  EXPOSE 8501
31
 
32
+ # Set Streamlit to run in headless mode
33
+ ENV STREAMLIT_SERVER_HEADLESS=true
34
+ ENV STREAMLIT_SERVER_ENABLE_CORS=false
35
 
36
+ # Run Streamlit
37
+ CMD ["streamlit", "run", "app.py"]