NeonSamurai commited on
Commit
80ebbd6
·
verified ·
1 Parent(s): 910aa86

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -1,38 +1,36 @@
1
- # Use Python slim image
2
  FROM python:3.13.5-slim
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  curl \
11
  git \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Ensure cache directories exist and are writable
15
- RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache \
16
- && mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
17
-
18
- # Copy requirements and install
19
  COPY requirements.txt ./
20
  RUN pip3 install --no-cache-dir -r requirements.txt
21
 
22
- # Copy all code and vectordb
23
  COPY . .
24
 
25
- # Expose Streamlit port
26
- EXPOSE 8501
27
-
28
- # Healthcheck
29
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
30
 
31
- # Streamlit config to avoid creating config files in root
32
  ENV STREAMLIT_HOME=/app/.streamlit
33
  ENV TRANSFORMERS_CACHE=/app/.cache
34
  ENV HF_HOME=/app/.cache
35
  ENV XDG_CACHE_HOME=/app/.cache
36
 
37
- # Run Streamlit app
 
 
 
 
 
 
38
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
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"]