File size: 2,431 Bytes
1341dff
6798fe5
 
37b70ed
6011d24
37b70ed
6011d24
 
6798fe5
37b70ed
1341dff
fd9356b
3d1cb43
 
 
 
 
1341dff
 
 
3d1cb43
1341dff
 
3d1cb43
6798fe5
6011d24
 
1341dff
6798fe5
3d1cb43
9b31009
 
831e9a6
9b31009
 
831e9a6
cb10a1d
9b31009
 
 
37b70ed
 
3d1cb43
9b31009
 
 
 
37b70ed
835f30d
3d1cb43
0586347
37b70ed
3d1cb43
 
 
 
37b70ed
3d1cb43
 
37b70ed
3d1cb43
37b70ed
 
0586347
37b70ed
0586347
6798fe5
0586347
b7de55b
37b70ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM node:18-bullseye-slim
USER root

# 1. Install Dependencies
RUN apt-get update && \
    apt-get install -y wget ffmpeg dumb-init procps && \
    apt-get autoremove -y && \
    rm -rf /var/lib/apt/lists/*

# 2. Setup Stremio
WORKDIR /stremio
RUN mkdir -p /root/.stremio-server

# 3. Create a SPECIFIC Disk Directory (Not /tmp)
# This forces it to use the container's overlay storage (Disk)
RUN mkdir -p /stremio/data

RUN wget https://dl.strem.io/four/v4.4.168/server.js -O server.js
RUN wget https://dl.strem.io/four/v4.4.168/stremio.asar -O stremio.asar

# 4. Install Proxy
RUN npm install http-proxy

# 5. Envs
ENV NO_CORS=1
ENV CASTING_DISABLED=1
ENV STREAMING_DISABLED=0
ENV PORT=11470

# 6. Status Page
RUN echo "const http = require('http'); \
const httpProxy = require('http-proxy'); \
const proxy = httpProxy.createProxyServer({}); \
const STREMIO_TARGET = 'http://127.0.0.1:11470'; \
\
proxy.on('error', function (err, req, res) { \
    res.writeHead(500); res.end('Booting...'); \
}); \
\
const server = http.createServer((req, res) => { \
    if (req.url === '/') { \
        res.writeHead(200, {'Content-Type': 'text/html'}); \
        res.end('<h1 style=\"color:blue;text-align:center;font-family:monospace;margin-top:20%\">💾 REAL DISK MODE <br> ⚡ 25GB CACHE | 500 CONNS</h1>'); \
    } else { \
        proxy.web(req, res, { target: STREMIO_TARGET }); \
    } \
}); \
server.listen(7860, '0.0.0.0');" > /stremio/proxy.js

# 7. The Startup Logic (Absolute Disk Force)
RUN echo "#!/bin/bash \n\
\n\
# --- STORAGE SETUP --- \n\
# We use /stremio/data. This is NOT /tmp. It is physical disk space. \n\
CACHE_ROOT=\"/stremio/data\" \n\
echo \"💾 FORCING STORAGE TO: \$CACHE_ROOT (OverlayFS)\" \n\
\n\
# --- SETTINGS --- \n\
# cacheSize: 25GB (26843545600 bytes) \n\
\n\
echo \"{\\\"cacheSize\\\": 26843545600, \\\"cacheRoot\\\": \\\"\$CACHE_ROOT\\\", \\\"btProfile\\\": \\\"ultra_fast\\\", \\\"btMaxConnections\\\": 500, \\\"connections\\\": 500, \\\"btHandshakeTimeout\\\": 20000, \\\"btRequestTimeout\\\": 4000, \\\"btDownloadSpeedSoftLimit\\\": 1677721600, \\\"btDownloadSpeedLimit\\\": 0, \\\"uploadSpeedLimit\\\": 1048576, \\\"btMinPeersForStable\\\": 100}\" > /root/.stremio-server/server-settings.json \n\
\n\
# Run \n\
node /stremio/proxy.js & \n\
node /stremio/server.js" > /stremio/start.sh && chmod +x /stremio/start.sh

EXPOSE 7860
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/stremio/start.sh"]