void0028 commited on
Commit
1341dff
·
verified ·
1 Parent(s): 835f30d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -21
Dockerfile CHANGED
@@ -1,52 +1,63 @@
1
- FROM stremio/server:latest
 
2
 
 
3
  USER root
4
 
5
- # 1. Install ffmpeg (to fix startup crash) & npm (for proxy)
6
  RUN apt-get update && \
7
- apt-get install -y ffmpeg npm && \
8
- npm install http-proxy && \
9
  apt-get autoremove -y && \
10
  rm -rf /var/lib/apt/lists/*
11
 
12
- # 2. Configure Stremio
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ENV NO_CORS=1
14
  ENV CASTING_DISABLED=1
15
  ENV STREAMING_DISABLED=0
 
16
 
17
- # 3. Create the Proxy Script (The "Green Screen" Maker)
18
  RUN echo "const http = require('http'); \
19
  const httpProxy = require('http-proxy'); \
20
  const proxy = httpProxy.createProxyServer({}); \
21
  const STREMIO_TARGET = 'http://127.0.0.1:11470'; \
22
  \
 
23
  proxy.on('error', function (err, req, res) { \
24
- console.error('Proxy Error:', err); \
25
  res.writeHead(500, { 'Content-Type': 'text/plain' }); \
26
- res.end('Proxy Error'); \
27
  }); \
28
  \
29
  const server = http.createServer((req, res) => { \
 
30
  if (req.url === '/' || req.url === '/health') { \
31
  res.writeHead(200, { 'Content-Type': 'text/html' }); \
32
- res.end('<body style=\"background:black;color:#00ff00;font-family:monospace;display:flex;align-items:center;justify-content:center;height:100vh;\"><h1>✅ STREMIO ONLINE<br>Status: Running</h1></body>'); \
33
  } else { \
 
34
  proxy.web(req, res, { target: STREMIO_TARGET }); \
35
  } \
36
  }); \
37
  \
38
- server.listen(7860); \
39
- console.log('UI Proxy listening on port 7860');" > /root/proxy.js
40
-
41
- # 4. Create a Startup Script to force both to run
42
- RUN echo "#!/bin/bash \n\
43
- node server.js & \n\
44
- sleep 5 \n\
45
- node /root/proxy.js" > /root/start.sh && chmod +x /root/start.sh
46
 
47
- # 5. Expose Ports
48
  EXPOSE 7860
49
- EXPOSE 11470
50
 
51
- # 6. Run the Script
52
- CMD ["/root/start.sh"]
 
1
+ # We use a clean, stable Node.js base. No hidden entrypoints.
2
+ FROM node:18-bullseye-slim
3
 
4
+ # Switch to root to install dependencies manually
5
  USER root
6
 
7
+ # 1. Install system tools + ffmpeg (Standard path) + procps (for signal handling)
8
  RUN apt-get update && \
9
+ apt-get install -y wget ffmpeg procps && \
 
10
  apt-get autoremove -y && \
11
  rm -rf /var/lib/apt/lists/*
12
 
13
+ # 2. Setup the Stremio Directory
14
+ WORKDIR /stremio
15
+
16
+ # 3. Download the Official Stremio Server Engine (Manually)
17
+ # This gets the latest stable v4 server directly from the source.
18
+ RUN wget https://dl.strem.io/four/v4.4.168/server.js -O server.js
19
+ RUN wget https://dl.strem.io/four/v4.4.168/stremio.asar -O stremio.asar
20
+
21
+ # 4. Install the Proxy Package (For the Green Screen)
22
+ RUN npm install http-proxy
23
+
24
+ # 5. Set Environment Variables (The Tiniest Details)
25
+ # NO_CORS=1 -> Allows your Phone/TV to connect.
26
+ # PORT=11470 -> Tells Stremio where to run internally.
27
  ENV NO_CORS=1
28
  ENV CASTING_DISABLED=1
29
  ENV STREAMING_DISABLED=0
30
+ ENV PORT=11470
31
 
32
+ # 6. Create the Proxy Script (Bridges HF Port 7860 -> Stremio 11470)
33
  RUN echo "const http = require('http'); \
34
  const httpProxy = require('http-proxy'); \
35
  const proxy = httpProxy.createProxyServer({}); \
36
  const STREMIO_TARGET = 'http://127.0.0.1:11470'; \
37
  \
38
+ // Silent Error Handling \
39
  proxy.on('error', function (err, req, res) { \
 
40
  res.writeHead(500, { 'Content-Type': 'text/plain' }); \
41
+ res.end('Proxy Error: Stremio is booting...'); \
42
  }); \
43
  \
44
  const server = http.createServer((req, res) => { \
45
+ // HF Health Check \
46
  if (req.url === '/' || req.url === '/health') { \
47
  res.writeHead(200, { 'Content-Type': 'text/html' }); \
48
+ res.end('<body style=\"background:black;color:#00ff00;font-family:monospace;display:flex;align-items:center;justify-content:center;height:100vh;\"><h1>✅ STREMIO ENGINE ONLINE<br><span style=\"color:white;font-size:12px\">Status: Active | FFMPEG: Ready</span></h1></body>'); \
49
  } else { \
50
+ // Forward traffic \
51
  proxy.web(req, res, { target: STREMIO_TARGET }); \
52
  } \
53
  }); \
54
  \
55
+ server.listen(7860, '0.0.0.0', () => { \
56
+ console.log('Main Proxy listening on 7860'); \
57
+ });" > /stremio/proxy.js
 
 
 
 
 
58
 
59
+ # 7. Expose the Hugging Face Port
60
  EXPOSE 7860
 
61
 
62
+ # 8. Start Both Services (The robust way)
63
+ CMD ["sh", "-c", "node /stremio/proxy.js & node /stremio/server.js"]