Ananthakr1shnan commited on
Commit
99ee319
·
verified ·
1 Parent(s): a58aa1b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +49 -40
Dockerfile CHANGED
@@ -1,41 +1,50 @@
1
- FROM python:3.11-slim
2
-
3
- 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 \
10
- build-essential \
11
- curl \
12
- && rm -rf /var/lib/apt/lists/*
13
-
14
- # Copy requirements and install
15
- 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
- # Copy application code
24
- COPY . .
25
-
26
- # Create necessary directories with proper permissions
27
- RUN mkdir -p /app/data /app/logs /app/chroma_persist /app/uploads /app/tmp /app/config /app/chroma_db && \
28
- chmod -R 755 /app/data /app/logs /app/chroma_persist /app/uploads /app/tmp /app/config /app/chroma_db
29
-
30
- # Create tmp directory in standard location as well
31
- RUN mkdir -p /tmp/researchmate && chmod 755 /tmp/researchmate
32
-
33
- # Spaces uses port 7860
34
- EXPOSE 7860
35
-
36
- # Health check
37
- HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
38
- CMD curl -f http://localhost:7860/health || exit 1
39
-
40
- # Start the application
 
 
 
 
 
 
 
 
 
41
  CMD ["python", "main.py"]
 
1
+ FROM python:3.11-slim
2
+
3
+ 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 \
10
+ build-essential \
11
+ curl \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy requirements and install
15
+ 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
+ # Copy application code
24
+ COPY . .
25
+
26
+ # Create necessary directories with proper write permissions
27
+ RUN mkdir -p /app/data /app/logs /app/chroma_persist /app/uploads /app/tmp /app/config /app/chroma_db && \
28
+ chmod -R 755 /app/data /app/logs /app/chroma_persist /app/uploads /app/tmp /app/config /app/chroma_db
29
+
30
+ # Create tmp directory in standard location
31
+ RUN mkdir -p /tmp/researchmate && chmod 777 /tmp/researchmate
32
+
33
+ # Set matplotlib config directory to writable location
34
+ ENV MPLCONFIGDIR=/tmp/matplotlib
35
+
36
+ # Create matplotlib config directory
37
+ RUN mkdir -p /tmp/matplotlib && chmod 777 /tmp/matplotlib
38
+
39
+ # Ensure the app directory has proper permissions
40
+ RUN chmod -R 755 /app
41
+
42
+ # Spaces uses port 7860
43
+ EXPOSE 7860
44
+
45
+ # Health check
46
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
47
+ CMD curl -f http://localhost:7860/health || exit 1
48
+
49
+ # Start the application
50
  CMD ["python", "main.py"]