nimazasinich Cursor Agent bxsfy712 commited on
Commit
da2af74
·
1 Parent(s): 336ef33

Refactor Dockerfile for security and add README metadata (#120)

Browse files

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: bxsfy712 <[email protected]>

Files changed (2) hide show
  1. Dockerfile +10 -3
  2. README.md +6 -0
Dockerfile CHANGED
@@ -19,8 +19,12 @@ RUN pip install --no-cache-dir -r requirements.txt
19
  # Copy the entire project
20
  COPY . .
21
 
22
- # Create data directory for SQLite databases
23
- RUN mkdir -p data
 
 
 
 
24
 
25
  # Expose port 7860 (Hugging Face Spaces standard)
26
  EXPOSE 7860
@@ -32,7 +36,10 @@ ENV PYTHONUNBUFFERED=1
32
 
33
  # Health check
34
  HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
35
- CMD curl -f http://localhost:7860/api/health || exit 1
 
 
 
36
 
37
  # Start the FastAPI server
38
  CMD ["python", "-m", "uvicorn", "hf_unified_server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
19
  # Copy the entire project
20
  COPY . .
21
 
22
+ # Create data directory for SQLite databases (must be writable at runtime)
23
+ RUN mkdir -p /app/data && chmod -R a+rwx /app/data
24
+
25
+ # Create a non-root user for runtime (HF Spaces may run as non-root)
26
+ RUN useradd -m -u 1000 appuser \
27
+ && chown -R appuser:appuser /app
28
 
29
  # Expose port 7860 (Hugging Face Spaces standard)
30
  EXPOSE 7860
 
36
 
37
  # Health check
38
  HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
39
+ CMD curl -f "http://localhost:${PORT:-7860}/api/health" || exit 1
40
+
41
+ # Drop privileges for runtime
42
+ USER appuser
43
 
44
  # Start the FastAPI server
45
  CMD ["python", "-m", "uvicorn", "hf_unified_server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
README.md CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  # Unified Crypto Data Platform 🚀
2
 
3
  **Version**: 2.0.0 (Production Ready)
 
1
+ ---
2
+ title: Unified Crypto Data Platform
3
+ sdk: docker
4
+ app_port: 7860
5
+ ---
6
+
7
  # Unified Crypto Data Platform 🚀
8
 
9
  **Version**: 2.0.0 (Production Ready)