Use backend app instead of space_app
Browse files- Dockerfile +9 -1
- space_app.py +0 -20
Dockerfile
CHANGED
|
@@ -17,5 +17,13 @@ COPY . .
|
|
| 17 |
# HF routes traffic to $PORT – bind to it
|
| 18 |
ENV PORT=7860 PYTHONUNBUFFERED=1
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# One worker is fine (single-user demo)
|
| 21 |
-
|
|
|
|
|
|
| 17 |
# HF routes traffic to $PORT – bind to it
|
| 18 |
ENV PORT=7860 PYTHONUNBUFFERED=1
|
| 19 |
|
| 20 |
+
# Set environment variables for Phase 1
|
| 21 |
+
ENV DATA_ROOT=/data
|
| 22 |
+
ENV STUB_MODE=1
|
| 23 |
+
|
| 24 |
+
# Create data directories
|
| 25 |
+
RUN mkdir -p /data/artifacts /data/outputs /data/json_info /data/marker_output
|
| 26 |
+
|
| 27 |
# One worker is fine (single-user demo)
|
| 28 |
+
# Change this line to run your Flask app directly
|
| 29 |
+
CMD exec gunicorn -w 1 -k gthread -t 300 -b 0.0.0.0:${PORT} backend.runner.app:app
|
space_app.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
# space_app.py
|
| 2 |
-
import os
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
from flask import send_from_directory
|
| 5 |
-
from backend.runner.app import app # <-- reuse the backend Flask app
|
| 6 |
-
|
| 7 |
-
FRONTEND_DIR = (Path(__file__).parent / "frontend").resolve()
|
| 8 |
-
|
| 9 |
-
# Serve SPA + static from the same app/host as the API
|
| 10 |
-
@app.route("/", defaults={"path": ""})
|
| 11 |
-
@app.route("/<path:path>")
|
| 12 |
-
def static_proxy(path: str):
|
| 13 |
-
target = FRONTEND_DIR / path
|
| 14 |
-
if path and target.exists() and target.is_file():
|
| 15 |
-
return send_from_directory(str(FRONTEND_DIR), path)
|
| 16 |
-
return send_from_directory(str(FRONTEND_DIR), "index.html")
|
| 17 |
-
|
| 18 |
-
if __name__ == "__main__":
|
| 19 |
-
port = int(os.environ.get("PORT", 7860))
|
| 20 |
-
app.run(host="0.0.0.0", port=port)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|