File size: 1,284 Bytes
0c591a7
b06b0fc
0c591a7
b06b0fc
 
 
 
 
 
 
 
e6152f5
 
b06b0fc
 
 
 
19a7a8f
 
b06b0fc
 
0c591a7
 
 
 
 
 
 
 
 
 
 
 
05b62e8
0c591a7
19a7a8f
 
0c591a7
 
 
 
 
 
 
 
 
 
 
b06b0fc
0c591a7
d56d23e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Dockerfile for HF Spaces (Docker SDK)
# Multi-stage build: Node.js for frontend, Python for backend

# Stage 1: Build frontend
FROM node:20-slim AS frontend-builder

WORKDIR /frontend

# Copy package files first for better caching
COPY frontend/package.json frontend/package-lock.json ./

# Install dependencies (use npm install to resolve version mismatches)
RUN npm install --legacy-peer-deps

# Copy frontend source code
COPY frontend/ ./

# Build the frontend (override outDir to build within /frontend)
RUN npm run build -- --outDir dist

# Stage 2: Python backend with built frontend
FROM python:3.11-slim

WORKDIR /app

# Copy Python requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY src/ ./src/
COPY a2a/ ./a2a/
COPY data/ ./data/
# Note: Don't copy .env file - HF Spaces injects secrets as environment variables

# Copy built frontend from stage 1
COPY --from=frontend-builder /frontend/dist ./static/

# Verify static files exist
RUN ls -la /app/static/ && ls -la /app/static/assets/

# Expose port (HF Spaces uses 7860)
EXPOSE 7860

# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app

# Start server
CMD ["uvicorn", "src.api.app:app", "--host", "0.0.0.0", "--port", "7860"]