NeerajCodz commited on
Commit
df861a1
·
1 Parent(s): 0cfd364

chore: add Docker configuration for HuggingFace Spaces

Browse files
Files changed (4) hide show
  1. .dockerignore +14 -0
  2. .env.example +12 -0
  3. Dockerfile +36 -0
  4. docker-compose.yml +13 -0
.dockerignore ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .gitignore
3
+ *.md
4
+ docs/
5
+ .env
6
+ .env.local
7
+ __pycache__
8
+ *.pyc
9
+ .pytest_cache
10
+ .ruff_cache
11
+ node_modules
12
+ .vite
13
+ dist
14
+ *.log
.env.example ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLM Providers (optional - app works without them)
2
+ OPENAI_API_KEY=
3
+ ANTHROPIC_API_KEY=
4
+ GOOGLE_API_KEY=
5
+ GROQ_API_KEY=
6
+
7
+ # HuggingFace
8
+ HF_TOKEN=
9
+
10
+ # App Settings
11
+ DEBUG=false
12
+ LOG_LEVEL=INFO
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build frontend
2
+ FROM node:20-alpine AS frontend-builder
3
+ WORKDIR /app/frontend
4
+ COPY frontend/package*.json ./
5
+ RUN npm ci
6
+ COPY frontend/ ./
7
+ RUN npm run build
8
+
9
+ # Stage 2: Python runtime
10
+ FROM python:3.11-slim
11
+ WORKDIR /app
12
+
13
+ # Install system deps
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ curl \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Install Python deps
19
+ COPY backend/requirements.txt ./
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Copy backend
23
+ COPY backend/app ./app
24
+
25
+ # Copy frontend build
26
+ COPY --from=frontend-builder /app/frontend/dist ./static
27
+
28
+ # Expose port (HF Spaces uses 7860)
29
+ EXPOSE 7860
30
+
31
+ # Health check
32
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
33
+ CMD curl -f http://localhost:7860/health || exit 1
34
+
35
+ # Run
36
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
docker-compose.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+ services:
3
+ app:
4
+ build: .
5
+ ports:
6
+ - "7860:7860"
7
+ environment:
8
+ - DEBUG=true
9
+ - LOG_LEVEL=DEBUG
10
+ volumes:
11
+ - ./backend/app:/app/app
12
+ env_file:
13
+ - .env