File size: 1,955 Bytes
97167a5
05af07f
 
97167a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145846b
 
 
 
 
 
 
 
 
 
97167a5
145846b
 
05af07f
 
 
 
 
145846b
 
 
 
 
 
 
97167a5
 
145846b
97167a5
 
 
 
 
d582adb
145846b
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
# Stage 1: Build frontend with Node
# CACHE BUSTER v3: 2026-06-02 21:40:00Z - BasicRAG fairness fix + graph traversal + deployment rebuild
# Latest commits: 799cd4dc (fairness), 9d7f1961 (rebuild), 8d2485c4 (timestamp)
FROM node:18-alpine AS frontend-builder

WORKDIR /build/frontend

# Copy frontend files
COPY frontend/package.json frontend/package-lock.json ./
COPY frontend/vite.config.js ./
COPY frontend/index.html ./
COPY frontend/src ./src

# Install and build frontend
RUN npm install --legacy-peer-deps --no-audit && \
    npm run build && \
    echo "βœ… Frontend built successfully"

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

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy Python requirements
COPY requirements.txt .

# CACHE BUSTER: Force rebuild for latest fixes (299cd4dc)
RUN echo "πŸ”„ REBUILDING with latest fixes - $(date)" && \
    echo "Latest commits: 799cd4dc (BasicRAG fairness), 9d7f1961 (rebuild), 8d2485c4 (timestamp)" && \
    echo "Deployed at: 2026-06-02T21:40:00Z"

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
    pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

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

# Verify frontend was built
RUN echo "Verifying frontend build..." && \
    ls -la frontend/dist/ && \
    [ -f frontend/dist/index.html ] && echo "βœ… index.html exists" || echo "❌ index.html missing" && \
    [ -d frontend/dist/assets ] && echo "βœ… assets folder exists" || echo "❌ assets folder missing"

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860

# Expose port
EXPOSE 7860

# Start command
CMD ["uvicorn", "backend.api.server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]