Ananthakr1shnan commited on
Commit
de8f515
·
verified ·
1 Parent(s): 85c8c23

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -8
Dockerfile CHANGED
@@ -4,6 +4,7 @@ WORKDIR /app
4
 
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
 
7
 
8
  # Install system dependencies
9
  RUN apt-get update && apt-get install -y \
@@ -16,13 +17,18 @@ COPY requirements.txt .
16
  RUN pip install --no-cache-dir --upgrade pip && \
17
  pip install --no-cache-dir -r requirements.txt
18
 
19
- # Pre-download embedding models
20
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
21
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-mpnet-base-v2')"
22
 
23
- # Create writable directories in /tmp (this is the key change)
24
- RUN mkdir -p /tmp/researchmate/data /tmp/researchmate/logs /tmp/researchmate/chroma_persist \
25
- /tmp/researchmate/uploads /tmp/researchmate/chroma_db && \
 
 
 
 
 
26
  chmod -R 777 /tmp/researchmate
27
 
28
  # Set environment variables for writable paths
@@ -32,9 +38,29 @@ ENV CHROMA_DIR=/tmp/researchmate/chroma_persist
32
  ENV UPLOADS_DIR=/tmp/researchmate/uploads
33
  ENV CHROMA_DB_DIR=/tmp/researchmate/chroma_db
34
 
35
- # Set matplotlib config directory to writable location
36
  ENV MPLCONFIGDIR=/tmp/matplotlib
37
- RUN mkdir -p /tmp/matplotlib && chmod 777 /tmp/matplotlib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  # Copy application code
40
  COPY . .
 
4
 
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
+ ENV DOCKER_ENV=true
8
 
9
  # Install system dependencies
10
  RUN apt-get update && apt-get install -y \
 
17
  RUN pip install --no-cache-dir --upgrade pip && \
18
  pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Pre-download embedding models with correct names
21
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" || echo "Failed to download all-MiniLM-L6-v2"
22
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-mpnet-base-v2')" || echo "Failed to download all-mpnet-base-v2"
23
 
24
+ # Create writable directories in /tmp
25
+ RUN mkdir -p /tmp/researchmate/data \
26
+ /tmp/researchmate/logs \
27
+ /tmp/researchmate/chroma_persist \
28
+ /tmp/researchmate/uploads \
29
+ /tmp/researchmate/chroma_db \
30
+ /tmp/researchmate/config \
31
+ /tmp/researchmate/tmp && \
32
  chmod -R 777 /tmp/researchmate
33
 
34
  # Set environment variables for writable paths
 
38
  ENV UPLOADS_DIR=/tmp/researchmate/uploads
39
  ENV CHROMA_DB_DIR=/tmp/researchmate/chroma_db
40
 
41
+ # Set all cache directories to writable locations
42
  ENV MPLCONFIGDIR=/tmp/matplotlib
43
+ ENV TRANSFORMERS_CACHE=/tmp/transformers
44
+ ENV HF_HOME=/tmp/huggingface
45
+ ENV SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers
46
+ ENV HF_DATASETS_CACHE=/tmp/datasets
47
+ ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface_hub
48
+ ENV XDG_CACHE_HOME=/tmp/cache
49
+
50
+ RUN mkdir -p /tmp/matplotlib \
51
+ /tmp/transformers \
52
+ /tmp/huggingface \
53
+ /tmp/sentence_transformers \
54
+ /tmp/datasets \
55
+ /tmp/huggingface_hub \
56
+ /tmp/cache && \
57
+ chmod -R 777 /tmp/matplotlib \
58
+ /tmp/transformers \
59
+ /tmp/huggingface \
60
+ /tmp/sentence_transformers \
61
+ /tmp/datasets \
62
+ /tmp/huggingface_hub \
63
+ /tmp/cache
64
 
65
  # Copy application code
66
  COPY . .