Darayut commited on
Commit
dd69e8f
·
verified ·
1 Parent(s): bb79799

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -26
Dockerfile CHANGED
@@ -1,43 +1,43 @@
1
  FROM python:3.11-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
 
 
 
 
 
 
 
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
- software-properties-common \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Set environment variables for cache directories and Streamlit config
14
- ENV STREAMLIT_HOME=/app/.streamlit
15
- ENV HF_HOME=/app/.cache/huggingface
16
- ENV TRANSFORMERS_CACHE=/app/.cache/transformers
17
- ENV TORCH_HOME=/app/.cache/torch
18
- ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
19
 
20
- # Copy requirements and install Python dependencies
21
- COPY requirements.txt ./
22
- RUN pip3 install -r requirements.txt
23
-
24
- # Copy source code
25
  COPY src/ ./src/
26
 
27
- # Create necessary directories with proper permissions
28
- RUN mkdir -p /app/.streamlit \
29
- /app/.cache/huggingface \
30
- /app/.cache/transformers \
31
- /app/.cache/torch \
32
- /app/src/data \
33
- /app/src/chroma \
34
- && chmod -R 777 /app/.streamlit \
35
- /app/.cache \
36
- /app/src/data \
37
- /app/src/chroma
38
 
 
39
  EXPOSE 8501
40
 
41
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
42
-
43
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.11-slim
2
 
3
+ # Use /app as working directory
4
  WORKDIR /app
5
 
6
+ # Set HOME to /app so Streamlit doesn't try writing to /
7
+ ENV HOME=/app
8
+
9
+ # Environment variables for Streamlit and cache
10
+ ENV STREAMLIT_HOME=$HOME/.streamlit
11
+ ENV HF_HOME=$HOME/.cache/huggingface
12
+ ENV TRANSFORMERS_CACHE=$HOME/.cache/transformers
13
+ ENV TORCH_HOME=$HOME/.cache/torch
14
+ ENV STREAMLIT_CONFIG_DIR=$HOME/.streamlit
15
+
16
+ # Install dependencies
17
  RUN apt-get update && apt-get install -y \
18
  build-essential \
19
  curl \
 
20
  git \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Install Python dependencies
24
+ COPY requirements.txt .
25
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
26
 
27
+ # Copy your source code
 
 
 
 
28
  COPY src/ ./src/
29
 
30
+ # Create writable directories for Streamlit and Chroma
31
+ RUN mkdir -p $HOME/.streamlit \
32
+ $HOME/.cache/huggingface \
33
+ $HOME/.cache/transformers \
34
+ $HOME/.cache/torch \
35
+ $HOME/src/data \
36
+ $HOME/src/chroma \
37
+ && chmod -R 777 $HOME
 
 
 
38
 
39
+ # Streamlit port
40
  EXPOSE 8501
41
 
42
+ # Run the Streamlit app
 
43
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]