Remove node_modules and add gitignore
Browse files- .dockerignore +11 -0
- .gitignore +13 -0
- Dockerfile +30 -0
- backend/main.py +11 -5
.dockerignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules/
|
| 2 |
+
.venv/
|
| 3 |
+
.git/
|
| 4 |
+
__pycache__/
|
| 5 |
+
*.pyc
|
| 6 |
+
.env
|
| 7 |
+
.env.local
|
| 8 |
+
dashboard/dist/
|
| 9 |
+
.vscode/
|
| 10 |
+
data/notiflow_data.xlsx
|
| 11 |
+
data/agent_memory.json
|
.gitignore
CHANGED
|
@@ -1,3 +1,16 @@
|
|
| 1 |
__pycache__/
|
| 2 |
|
| 3 |
.env
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
__pycache__/
|
| 2 |
|
| 3 |
.env
|
| 4 |
+
node_modules/
|
| 5 |
+
dashboard/node_modules/
|
| 6 |
+
|
| 7 |
+
.venv/
|
| 8 |
+
.git/
|
| 9 |
+
__pycache__/
|
| 10 |
+
*.pyc
|
| 11 |
+
.env
|
| 12 |
+
.env.local
|
| 13 |
+
dashboard/dist/
|
| 14 |
+
.vscode/
|
| 15 |
+
data/notiflow_data.xlsx
|
| 16 |
+
data/agent_memory.json
|
Dockerfile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Build the Vite frontend
|
| 2 |
+
FROM node:18-alpine AS frontend-builder
|
| 3 |
+
WORKDIR /app/dashboard
|
| 4 |
+
COPY dashboard/package*.json ./
|
| 5 |
+
RUN npm ci
|
| 6 |
+
COPY dashboard/ ./
|
| 7 |
+
RUN npm run build
|
| 8 |
+
|
| 9 |
+
# Stage 2: Serve the backend with FastAPI
|
| 10 |
+
FROM python:3.11-slim
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
|
| 13 |
+
# Install Python backend dependencies
|
| 14 |
+
COPY backend/requirements.txt ./
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy the entire project code
|
| 18 |
+
COPY . /app
|
| 19 |
+
|
| 20 |
+
# Copy the compiled frontend output from the builder stage
|
| 21 |
+
COPY --from=frontend-builder /app/dashboard/dist /app/dashboard/dist
|
| 22 |
+
|
| 23 |
+
# Expose the port Hugging Face Spaces expects
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Set environment variables for production behavior
|
| 27 |
+
ENV NOTIFLOW_DEMO_MODE=false
|
| 28 |
+
|
| 29 |
+
# Start the uvicorn server on the HF port
|
| 30 |
+
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
backend/main.py
CHANGED
|
@@ -113,13 +113,19 @@ async def health():
|
|
| 113 |
|
| 114 |
|
| 115 |
# ---------------------------------------------------------------------------
|
| 116 |
-
#
|
| 117 |
# ---------------------------------------------------------------------------
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
|
| 125 |
# ---------------------------------------------------------------------------
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
# ---------------------------------------------------------------------------
|
| 116 |
+
# Frontend static files or root redirect
|
| 117 |
# ---------------------------------------------------------------------------
|
| 118 |
|
| 119 |
+
from fastapi.staticfiles import StaticFiles
|
| 120 |
+
|
| 121 |
+
_frontend_dist = Path(_PROJECT_ROOT) / "dashboard" / "dist"
|
| 122 |
+
if _frontend_dist.is_dir():
|
| 123 |
+
app.mount("/", StaticFiles(directory=str(_frontend_dist), html=True), name="dashboard")
|
| 124 |
+
else:
|
| 125 |
+
@app.get("/", include_in_schema=False)
|
| 126 |
+
async def root():
|
| 127 |
+
from fastapi.responses import RedirectResponse
|
| 128 |
+
return RedirectResponse(url="/docs")
|
| 129 |
|
| 130 |
|
| 131 |
# ---------------------------------------------------------------------------
|