File size: 1,132 Bytes
8ee5513
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# SentinelEdge Demo - Hugging Face Spaces Deployment
# Serves React frontend + FastAPI backend from a single container

FROM node:20-slim AS frontend-build

WORKDIR /build
COPY demo/frontend/package.json demo/frontend/package-lock.json* ./
RUN npm install --production=false
COPY demo/frontend/ .
RUN npm run build

# --- Python runtime ---
FROM python:3.11-slim

# System deps for PyNaCl (libsodium)
RUN apt-get update && \
    apt-get install -y --no-install-recommends libsodium-dev && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install only the deps we actually need for the demo (no whisper/pyaudio/onnx)
COPY requirements-deploy.txt .
RUN pip install --no-cache-dir -r requirements-deploy.txt

# Copy project code
COPY sentinel_edge/ sentinel_edge/
COPY hub/ hub/
COPY demo/backend/ demo/backend/
COPY models/ models/
COPY federated/ federated/

# Copy built frontend into a static dir the backend will serve
COPY --from=frontend-build /build/dist /app/static

# Copy the deployment server entrypoint
COPY deploy_server.py .

# HF Spaces expects port 7860
ENV PORT=7860
EXPOSE 7860

CMD ["python", "deploy_server.py"]