OpticParse Deployer commited on
Commit
b6fd289
·
1 Parent(s): e5ecd89

deploy python api with HF metadata [isolated]

Browse files
Files changed (2) hide show
  1. Dockerfile +18 -3
  2. start.sh +18 -0
Dockerfile CHANGED
@@ -8,8 +8,9 @@ ENV PYTHONUNBUFFERED=1 \
8
 
9
  WORKDIR /app
10
 
11
- # Install system dependencies for Chromium
12
  RUN apt-get update && apt-get install -y \
 
13
  libnss3 \
14
  libnspr4 \
15
  libatk1.0-0 \
@@ -32,6 +33,11 @@ RUN apt-get update && apt-get install -y \
32
  libasound2 \
33
  && rm -rf /var/lib/apt/lists/*
34
 
 
 
 
 
 
35
  ENV PLAYWRIGHT_BROWSERS_PATH=0
36
 
37
  # Install Python dependencies first (cached layer)
@@ -44,9 +50,18 @@ RUN PLAYWRIGHT_BROWSERS_PATH=0 python -m playwright install chromium
44
  # Copy application code
45
  COPY . .
46
 
 
 
 
 
 
 
 
 
47
  # Expose default port
48
  EXPOSE 7860
49
 
50
- # Start with uvicorn, binding to $PORT for Render/HuggingFace compatibility
51
- CMD uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860}
 
52
 
 
8
 
9
  WORKDIR /app
10
 
11
+ # Install system dependencies for Chromium and Node.js install tools
12
  RUN apt-get update && apt-get install -y \
13
+ curl \
14
  libnss3 \
15
  libnspr4 \
16
  libatk1.0-0 \
 
33
  libasound2 \
34
  && rm -rf /var/lib/apt/lists/*
35
 
36
+ # Install Node.js
37
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
38
+ apt-get install -y nodejs && \
39
+ rm -rf /var/lib/apt/lists/*
40
+
41
  ENV PLAYWRIGHT_BROWSERS_PATH=0
42
 
43
  # Install Python dependencies first (cached layer)
 
50
  # Copy application code
51
  COPY . .
52
 
53
+ # Build Node.js app
54
+ WORKDIR /app/opticparse-js
55
+ RUN npm install --production=false && npm run build
56
+
57
+ # Make startup script executable and configure launch command
58
+ WORKDIR /app
59
+ RUN chmod +x start.sh
60
+
61
  # Expose default port
62
  EXPOSE 7860
63
 
64
+ # Start with our unified startup script
65
+ CMD ["./start.sh"]
66
+
67
 
start.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Start PhishVision Node.js Server in the background on port 3001
5
+ echo "Starting PhishVision Node Server on port 3001..."
6
+ cd /app/opticparse-js
7
+ export PORT=3001
8
+ export NODE_ENV=production
9
+ node dist/phish-server.js &
10
+
11
+ # Wait a second for Node to start
12
+ sleep 2
13
+
14
+ # Start OpticParse Python FastAPI Server in the foreground on port 7860
15
+ echo "Starting OpticParse Python Server on port 7860..."
16
+ cd /app
17
+ export PHISHVISION_BACKEND_URL="http://localhost:3001"
18
+ exec uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860}