MoizK commited on
Commit
8a82346
·
verified ·
1 Parent(s): 0e918bb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -46
Dockerfile CHANGED
@@ -1,47 +1,44 @@
1
- # Use Python 3.10 slim image as base
2
- FROM python:3.10-slim
3
-
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
13
- WORKDIR /app
14
-
15
- # Set environment variables
16
- ENV PYTHONUNBUFFERED=1
17
- ENV TRANSFORMERS_CACHE=/app/model_cache
18
- 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
- # Download assets from Hugging Face Hub
41
- RUN python download_assets.py
42
-
43
- # Expose the port Chainlit runs on
44
- EXPOSE 7860
45
-
46
- # Run the Chainlit application
47
  CMD ["chainlit", "run", "model.py", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use Python 3.10 slim image as base
2
+ FROM python:3.10-slim
3
+
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
13
+ WORKDIR /app
14
+
15
+ # Set environment variables
16
+ ENV PYTHONUNBUFFERED=1
17
+ ENV TRANSFORMERS_CACHE=/app/model_cache
18
+ 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"]