MoizK commited on
Commit
280cf3f
·
verified ·
1 Parent(s): 1b52b0b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -10
Dockerfile CHANGED
@@ -4,9 +4,9 @@ FROM python:3.10-slim
4
  # Install system dependencies
5
  RUN apt-get update && \
6
  apt-get install -y \
7
- build-essential \
8
- git \
9
- poppler-utils \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Set working directory
@@ -19,26 +19,33 @@ ENV HF_HOME=/app/model_cache
19
  ENV TORCH_HOME=/app/model_cache
20
  ENV CHAINLIT_HOST=0.0.0.0
21
  ENV CHAINLIT_PORT=7860
 
 
22
 
23
  # Install Python dependencies
24
  COPY requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # Create necessary directories
28
- RUN mkdir -p /app/model_cache /app/vectorstore/db_faiss /app/data
 
 
 
 
 
29
 
30
  # Copy application files
31
  COPY model.py ingest.py chainlit.md download_assets.py ./
32
 
33
  # Download models and cache them
34
  RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \
35
- AutoTokenizer.from_pretrained('google/flan-t5-base'); \
36
- AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base'); \
37
- from sentence_transformers import SentenceTransformer; \
38
- SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
39
 
40
  # Expose the port Chainlit runs on
41
  EXPOSE 7860
42
 
43
  # Run the Chainlit application
44
- CMD ["chainlit", "run", "model.py", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # Install system dependencies
5
  RUN apt-get update && \
6
  apt-get install -y \
7
+ build-essential \
8
+ git \
9
+ poppler-utils \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Set working directory
 
19
  ENV TORCH_HOME=/app/model_cache
20
  ENV CHAINLIT_HOST=0.0.0.0
21
  ENV CHAINLIT_PORT=7860
22
+ # override Chainlit files directory to one we’ll own
23
+ ENV CHAINLIT_FILES_DIRECTORY=/tmp/.files
24
 
25
  # Install Python dependencies
26
  COPY requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
+ # Create necessary directories (including the Chainlit files dir)
30
+ RUN mkdir -p \
31
+ /app/model_cache \
32
+ /app/vectorstore/db_faiss \
33
+ /app/data \
34
+ /tmp/.files \
35
+ && chmod a+rwx /tmp/.files
36
 
37
  # Copy application files
38
  COPY model.py ingest.py chainlit.md download_assets.py ./
39
 
40
  # Download models and cache them
41
  RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \
42
+ AutoTokenizer.from_pretrained('google/flan-t5-base'); \
43
+ AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base'); \
44
+ from sentence_transformers import SentenceTransformer; \
45
+ SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
46
 
47
  # Expose the port Chainlit runs on
48
  EXPOSE 7860
49
 
50
  # Run the Chainlit application
51
+ CMD ["chainlit", "run", "model.py", "--host", "0.0.0.0", "--port", "7860"]