Rajhuggingface4253 commited on
Commit
87eb098
·
verified ·
1 Parent(s): e063eb7

Create dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +39 -0
dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim-bookworm
2
+
3
+ # Set environment variables
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+ ENV HF_HUB_ENABLE_HF_TRANSFER=1
6
+ ENV HF_HOME=/app/cache
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ git \
11
+ build-essential \
12
+ python3-dev \
13
+ libxml2-dev \
14
+ libxslt1-dev \
15
+ zlib1g-dev \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Set the working directory
19
+ WORKDIR /app
20
+
21
+ # Create and permission the cache directory
22
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
23
+
24
+ # Copy the requirements and install dependencies
25
+ COPY requirements.txt .
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Copy the application code and RAG engine
29
+ COPY app.py .
30
+ COPY rag_engine.py .
31
+
32
+ # Build RAG index (ingest URLs once during build)
33
+ RUN python rag_engine.py
34
+
35
+ # Expose the default port for Hugging Face Spaces
36
+ EXPOSE 7860
37
+
38
+ # Command to run the application
39
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]