khagu commited on
Commit
d933cce
·
1 Parent(s): 6b200ec

fix: rename Backend.Dockerfile to Dockerfile for Hugging Face

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.12-slim as the base image
2
+ FROM python:3.12-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ libmagic1 \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements.txt
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application code
20
+ COPY . .
21
+
22
+ # Expose the port the app runs on (Hugging Face Spaces uses 7860 by default)
23
+ EXPOSE 7860
24
+
25
+ # Script to build vector DBs and start the server
26
+ RUN echo '#!/bin/bash\n\
27
+ echo "Building Vector Databases..."\n\
28
+ python -m module_a.process_documents\n\
29
+ python -m module_a.build_vector_db\n\
30
+ python -m module_c.indexer\n\
31
+ echo "Starting FastAPI server on port ${PORT:-7860}..."\n\
32
+ uvicorn api.main:app --host 0.0.0.0 --port ${PORT:-7860}\n\
33
+ ' > /app/start.sh && chmod +x /app/start.sh
34
+
35
+ # Run the startup script
36
+ CMD ["/app/start.sh"]