Kalpokoch commited on
Commit
609217a
·
1 Parent(s): 5e84c99

updated dockerfile for quantized

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -20
Dockerfile CHANGED
@@ -1,38 +1,35 @@
1
- # Use official Python 3.11 image
2
  FROM python:3.11
3
 
4
- # Install system dependencies needed for building Python packages
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
 
 
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # Set working directory inside the container
10
  WORKDIR /app
11
 
12
- # Set Hugging Face cache directory and grant permissions
13
- # This helps with model downloads and caching within the Space
14
  ENV TRANSFORMERS_CACHE=/app/.cache \
15
- HF_HOME=/app/.cache
16
- RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
17
-
18
- # ✅ Ensure ChromaDB can write its persistent database
19
- # This directory will hold the DB built at runtime.
20
- # It MUST be a consistent, writable location for persistence.
21
- RUN mkdir -p /app/vector_database && chmod -R 777 /app/vector_database
22
 
23
- # Copy only the requirements file to leverage Docker cache
24
- COPY requirements.txt .
25
 
26
  # Install Python dependencies
 
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
- # Copy the rest of your application code, including 'app/' directory and 'processed_chunks.json'
30
- # Assuming 'app' and 'processed_chunks.json' are at the root level of your project
31
  COPY . .
32
 
33
- # Expose the port the app runs on
34
  EXPOSE 7860
35
 
36
- # Command to run the FastAPI application
37
- # 'app.app' refers to the 'app' FastAPI instance within 'app.py' inside the 'app' package
38
- CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use official Python 3.11 base image
2
  FROM python:3.11
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
+ cmake \
8
+ git \
9
+ curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Set working directory
13
  WORKDIR /app
14
 
15
+ # Set Hugging Face and ChromaDB cache directories
 
16
  ENV TRANSFORMERS_CACHE=/app/.cache \
17
+ HF_HOME=/app/.cache \
18
+ PYTHONUNBUFFERED=1 \
19
+ PERSIST_DIR=/app/vector_database
 
 
 
 
20
 
21
+ RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
22
+ RUN mkdir -p ${PERSIST_DIR} && chmod -R 777 ${PERSIST_DIR}
23
 
24
  # Install Python dependencies
25
+ COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Copy project code
 
29
  COPY . .
30
 
31
+ # Expose the port FastAPI will run on
32
  EXPOSE 7860
33
 
34
+ # Run the FastAPI app using uvicorn
35
+ CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]