ksri77 commited on
Commit
f03da16
·
1 Parent(s): 5c62a7a

chore: add Dockerfile for HuggingFace Spaces (port 7860, DB_PATH env var)

Browse files
Files changed (3) hide show
  1. Dockerfile +24 -0
  2. README.md +11 -0
  3. backend/db/schema.py +2 -1
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # OpenCV headless needs these system libs
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ libglib2.0-0 \
8
+ libsm6 \
9
+ libxrender1 \
10
+ libxext6 \
11
+ libgl1-mesa-glx \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ COPY . .
18
+
19
+ # HuggingFace Spaces persistent storage mounts at /data
20
+ ENV DB_PATH=/data/uicopilot.db
21
+
22
+ EXPOSE 7860
23
+
24
+ CMD ["uvicorn", "backend.api.main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # UICopilot
2
 
3
  **AI UI/UX Engineering Platform** — analyze, score, and improve the visual quality of your application.
 
1
+ ---
2
+ title: UICopilot
3
+ emoji: 🎨
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ license: mit
10
+ ---
11
+
12
  # UICopilot
13
 
14
  **AI UI/UX Engineering Platform** — analyze, score, and improve the visual quality of your application.
backend/db/schema.py CHANGED
@@ -9,13 +9,14 @@ Schema:
9
  """
10
  from __future__ import annotations
11
 
 
12
  import pathlib
13
  from contextlib import asynccontextmanager
14
  from typing import AsyncGenerator
15
 
16
  import aiosqlite
17
 
18
- _DEFAULT_PATH = pathlib.Path("data/uicopilot.db")
19
 
20
  DDL = """
21
  CREATE TABLE IF NOT EXISTS projects (
 
9
  """
10
  from __future__ import annotations
11
 
12
+ import os
13
  import pathlib
14
  from contextlib import asynccontextmanager
15
  from typing import AsyncGenerator
16
 
17
  import aiosqlite
18
 
19
+ _DEFAULT_PATH = pathlib.Path(os.environ.get("DB_PATH", "data/uicopilot.db"))
20
 
21
  DDL = """
22
  CREATE TABLE IF NOT EXISTS projects (