rishik1111 commited on
Commit
8454b60
·
1 Parent(s): 9a1ab63

feat(deploy): support cloud dynamic PORT binding in Dockerfile and app.py

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +6 -2
Dockerfile CHANGED
@@ -17,4 +17,4 @@ COPY . .
17
 
18
  EXPOSE 8000
19
 
20
- CMD ["python", "app.py", "--serve", "--port", "8000", "--host", "0.0.0.0"]
 
17
 
18
  EXPOSE 8000
19
 
20
+ CMD ["python", "app.py", "--serve", "--host", "0.0.0.0"]
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import argparse
 
2
  import sys
3
  from pathlib import Path
4
 
@@ -43,13 +44,16 @@ def run_pipeline(image_path: Path, write_blockchain: bool = True, max_results: i
43
  return result
44
 
45
  def main():
 
 
 
46
  parser = argparse.ArgumentParser(
47
  description="FaceID — Biometric Provenance & OSINT Forensic Pipeline"
48
  )
49
  parser.add_argument("--image", type=str, default=None, help="Path to input face image")
50
  parser.add_argument("--serve", action="store_true", help="Launch interactive Web UI & REST API")
51
- parser.add_argument("--port", type=int, default=8000, help="Port to bind server (default: 8000)")
52
- parser.add_argument("--host", type=str, default="127.0.0.1", help="Host address (default: 127.0.0.1)")
53
  parser.add_argument("--no-blockchain", action="store_true", help="Skip blockchain registration")
54
  parser.add_argument("--top-k", "--max-results", type=int, default=None, dest="top_k", help="Max search candidates to inspect")
55
  parser.add_argument("--threshold", type=float, default=None, help="Minimum cosine similarity threshold")
 
1
  import argparse
2
+ import os
3
  import sys
4
  from pathlib import Path
5
 
 
44
  return result
45
 
46
  def main():
47
+ default_port = int(os.getenv("PORT", "8000"))
48
+ default_host = os.getenv("HOST", "0.0.0.0" if os.getenv("PORT") else "127.0.0.1")
49
+
50
  parser = argparse.ArgumentParser(
51
  description="FaceID — Biometric Provenance & OSINT Forensic Pipeline"
52
  )
53
  parser.add_argument("--image", type=str, default=None, help="Path to input face image")
54
  parser.add_argument("--serve", action="store_true", help="Launch interactive Web UI & REST API")
55
+ parser.add_argument("--port", type=int, default=default_port, help=f"Port to bind server (default: {default_port})")
56
+ parser.add_argument("--host", type=str, default=default_host, help=f"Host address (default: {default_host})")
57
  parser.add_argument("--no-blockchain", action="store_true", help="Skip blockchain registration")
58
  parser.add_argument("--top-k", "--max-results", type=int, default=None, dest="top_k", help="Max search candidates to inspect")
59
  parser.add_argument("--threshold", type=float, default=None, help="Minimum cosine similarity threshold")