NeonSamurai commited on
Commit
7d7d2ce
·
verified ·
1 Parent(s): 3ced916

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -26
Dockerfile CHANGED
@@ -1,37 +1,31 @@
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"]
 
1
+ FROM python:3.13.5-slim
 
2
 
 
3
  WORKDIR /app
4
 
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ curl \
8
+ git \
9
+ && rm -rf /var/lib/apt/lists/*
 
10
 
11
+ # create a writable cache directory and make sure it's writable by the container process
12
+ RUN mkdir -p /app/.cache && chmod 0777 /app/.cache
 
 
13
 
14
+ # Force all relevant libraries to use /app/.cache (writable inside the container)
15
+ ENV HF_HOME=/app/.cache \
16
+ TRANSFORMERS_CACHE=/app/.cache \
17
+ SENTENCE_TRANSFORMERS_HOME=/app/.cache \
18
+ LLAMA_INDEX_CACHE_DIR=/app/.cache \
19
+ XDG_CACHE_HOME=/app/.cache
20
 
21
+ # Copy files and install dependencies
22
+ COPY requirements.txt ./
 
 
 
23
  COPY . .
24
 
25
+ RUN pip3 install --no-cache-dir -r requirements.txt
26
+
27
  EXPOSE 8501
28
 
29
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
 
 
30
 
31
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]