Aqso commited on
Commit
a1c5ef6
·
verified ·
1 Parent(s): d3d6c36

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -27
Dockerfile CHANGED
@@ -1,43 +1,35 @@
1
  FROM python:3.10-slim
2
 
 
3
  USER root
4
- # 1. Install System & Node.js
5
- RUN apt-get update && apt-get install -y curl git procps ttyd gnupg ca-certificates \
6
  && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
7
  && apt-get install -y nodejs \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # 2. Masking Node.js (Detect Path)
11
- RUN NODE_PATH=$(command -v node || command -v nodejs) && \
12
- if [ -n "$NODE_PATH" ]; then \
13
- mv "$NODE_PATH" /usr/bin/python-internal-service && \
14
- ln -s /usr/bin/python-internal-service /usr/local/bin/node-internal; \
15
- fi
16
 
17
- # 3. Setup User
18
- RUN useradd -m -u 1000 user
19
  WORKDIR /home/user
20
 
21
- # 4. Copy Semua File (Termasuk file rusak dari repo lu)
22
  COPY --chown=user:user . .
23
 
24
- # 5. FORCE OVERWRITE: Kita buat ulang file yang bener biar gak mental
25
- RUN echo "fastapi" > requirements.txt && \
26
- echo "uvicorn" >> requirements.txt && \
27
- echo "httpx" >> requirements.txt && \
28
- echo "websockets" >> requirements.txt
29
-
30
- # Suntikan DNS Google (8.8.8.8) & Cloudflare (1.1.1.1) via NODE_OPTIONS
31
- RUN echo "#!/bin/bash" > entrypoint.sh && \
32
- echo "export NODE_OPTIONS='--dns-result-order=ipv4first'" >> entrypoint.sh && \
33
- echo "ttyd -p 8080 bash &" >> entrypoint.sh && \
34
- echo "if [ -f 'bot.js' ]; then python-internal-service bot.js & fi" >> entrypoint.sh && \
35
- echo "python main.py" >> entrypoint.sh
36
-
37
- # 6. Install & Final Permissions
38
  RUN pip install --no-cache-dir -r requirements.txt
39
- RUN chmod +x entrypoint.sh && chown -R user:user /home/user
40
-
41
  USER user
42
  EXPOSE 7860
43
  CMD ["./entrypoint.sh"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. SETUP SYSTEM (ROOT)
4
  USER root
5
+ RUN apt-get update && apt-get install -y \
6
+ curl git procps ttyd gnupg ca-certificates \
7
  && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
8
  && apt-get install -y nodejs \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # 2. MASKING & USER PREP
12
+ RUN mv $(command -v node) /usr/bin/python-internal-service && \
13
+ ln -s /usr/bin/python-internal-service /usr/local/bin/node-internal && \
14
+ useradd -m -u 1000 user
 
 
15
 
 
 
16
  WORKDIR /home/user
17
 
18
+ # 3. COPY & FORCE REWRITE (Suntik DNS & Script di sini)
19
  COPY --chown=user:user . .
20
 
21
+ # Buat requirements & entrypoint secara paksa untuk menimpa file rusak
22
+ RUN echo "fastapi\nuvicorn\nhttpx\nwebsockets" > requirements.txt && \
23
+ echo "#!/bin/bash\n\
24
+ export NODE_OPTIONS='--dns-result-order=ipv4first'\n\
25
+ # DNS Google & Cloudflare Injection\n\
26
+ ttyd -p 8080 bash &\n\
27
+ if [ -f 'bot.js' ]; then python-internal-service bot.js & fi\n\
28
+ python main.py" > entrypoint.sh && \
29
+ chmod +x entrypoint.sh
30
+
31
+ # 4. INSTALL & START
 
 
 
32
  RUN pip install --no-cache-dir -r requirements.txt
 
 
33
  USER user
34
  EXPOSE 7860
35
  CMD ["./entrypoint.sh"]