File size: 1,141 Bytes
7aebb63
 
 
c993983
7aebb63
 
 
 
 
 
 
 
c993983
 
7aebb63
c993983
 
 
 
 
 
d8dfc5f
 
 
b506cd1
d8dfc5f
 
7aebb63
 
 
b506cd1
7aebb63
 
 
c993983
7aebb63
 
 
c993983
7aebb63
 
c993983
7aebb63
 
 
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
# --- Build Stage for Frontend ---
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend

COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci || npm install

COPY frontend/ ./
RUN npm run build

# --- Build Stage for Backend ---
FROM python:3.13-slim
WORKDIR /app

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

# Use the official uv binary
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uv/bin/uv
ENV PATH="/uv/bin:$PATH"

COPY backend/ ./backend/
RUN cd backend && uv pip install --system . --no-cache-dir

# Copy backend code
COPY backend/ ./backend/
RUN cd backend && uv pip install --system -e .

# Copy built frontend from the frontend-builder stage
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist

# Also copy other necessary directories from root if the backend needs them
COPY cop_analysis/ ./cop_analysis/
COPY data/ ./data/

# Expose Hugging Face Space port
EXPOSE 7860

# Run uvicorn server
WORKDIR /app/backend
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]