Pavanupadhyay27 commited on
Commit
3b7d241
·
1 Parent(s): 536e22c

feat: add Hugging Face Spaces Docker SDK support for backend

Browse files
Files changed (3) hide show
  1. Dockerfile +8 -2
  2. README.md +10 -0
  3. backend/Dockerfile +5 -2
Dockerfile CHANGED
@@ -18,8 +18,14 @@ RUN pip install --no-cache-dir -r requirements.txt
18
  # Copy backend code
19
  COPY backend/ .
20
 
 
 
 
 
 
 
21
  # Expose FastAPI port
22
  EXPOSE 8000
23
 
24
- # Run FastAPI app
25
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
18
  # Copy backend code
19
  COPY backend/ .
20
 
21
+ # Download ONNX model weights during container build
22
+ RUN python app/core/download_models.py
23
+
24
+ # Create directories and set full permissions so non-root users (like Hugging Face UID 1000) can read/write
25
+ RUN mkdir -p /workspace/uploads /workspace/models && chmod -R 777 /workspace
26
+
27
  # Expose FastAPI port
28
  EXPOSE 8000
29
 
30
+ # Run FastAPI app with dynamic port fallback
31
+ CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}"]
README.md CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  # NetraID - Production-Grade AI Face Authentication Attendance System
2
 
3
  NetraID is an enterprise-grade, 100% free, and self-hosted face-authentication attendance platform. Using advanced facial biometrics, liveness classifiers, and high-performance vector indexes, it provides an offline, secure, and production-ready system suitable for digital kiosks, schools, colleges, and startups.
 
1
+ ---
2
+ title: NetraID Backend
3
+ emoji: 🧑‍💼
4
+ colorFrom: cyan
5
+ colorTo: blue
6
+ sdk: docker
7
+ app_port: 8000
8
+ pinned: false
9
+ ---
10
+
11
  # NetraID - Production-Grade AI Face Authentication Attendance System
12
 
13
  NetraID is an enterprise-grade, 100% free, and self-hosted face-authentication attendance platform. Using advanced facial biometrics, liveness classifiers, and high-performance vector indexes, it provides an offline, secure, and production-ready system suitable for digital kiosks, schools, colleges, and startups.
backend/Dockerfile CHANGED
@@ -21,8 +21,11 @@ COPY . .
21
  # Download ONNX model weights during container build
22
  RUN python app/core/download_models.py
23
 
 
 
 
24
  # Expose FastAPI port
25
  EXPOSE 8000
26
 
27
- # Run FastAPI app
28
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
21
  # Download ONNX model weights during container build
22
  RUN python app/core/download_models.py
23
 
24
+ # Create directories and set full permissions so non-root users (like Hugging Face UID 1000) can read/write
25
+ RUN mkdir -p /workspace/uploads /workspace/models && chmod -R 777 /workspace
26
+
27
  # Expose FastAPI port
28
  EXPOSE 8000
29
 
30
+ # Run FastAPI app with dynamic port fallback
31
+ CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}"]