Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -34
Dockerfile
CHANGED
|
@@ -1,51 +1,35 @@
|
|
| 1 |
-
FROM debian:bullseye-slim
|
| 2 |
|
| 3 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
tor \
|
| 7 |
haproxy \
|
| 8 |
privoxy \
|
| 9 |
procps \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
RUN mkdir -p /tmp/tor && chown -R 1000:1000 /tmp/tor && chmod -R 777 /tmp/tor
|
| 13 |
-
|
| 14 |
-
RUN echo "listen-address 0.0.0.0:7860\n\
|
| 15 |
-
toggle 1\n\
|
| 16 |
-
enable-remote-toggle 0\n\
|
| 17 |
-
enable-remote-http-toggle 0\n\
|
| 18 |
-
enable-edit-actions 0\n\
|
| 19 |
-
enforce-blocks 0\n\
|
| 20 |
-
buffer-limit 4096\n\
|
| 21 |
-
forward-socks5t / 127.0.0.1:8888 ." > /etc/privoxy/config
|
| 22 |
-
|
| 23 |
-
RUN echo "defaults\n\
|
| 24 |
-
mode tcp\n\
|
| 25 |
-
timeout connect 10s\n\
|
| 26 |
-
timeout client 1m\n\
|
| 27 |
-
timeout server 1m\n\
|
| 28 |
-
frontend tor_front\n\
|
| 29 |
-
bind *:8888\n\
|
| 30 |
-
default_backend tor_back\n\
|
| 31 |
-
backend tor_back\n\
|
| 32 |
-
balance roundrobin\n\
|
| 33 |
-
server t0 127.0.0.1:9050 check\n\
|
| 34 |
-
server t1 127.0.0.1:9051 check\n\
|
| 35 |
-
server t2 127.0.0.1:9052 check\n\
|
| 36 |
-
server t3 127.0.0.1:9053 check\n\
|
| 37 |
-
server t4 127.0.0.1:9054 check" > /etc/haproxy/haproxy.cfg
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
RUN echo '#!/bin/bash\n\
|
| 40 |
-
for i in {0..
|
|
|
|
| 41 |
port=$((9050 + i))\n\
|
| 42 |
mkdir -p /tmp/tor/$i\n\
|
| 43 |
tor --SocksPort $port --DataDirectory /tmp/tor/$i --RunAsDaemon 1\n\
|
| 44 |
done\n\
|
| 45 |
haproxy -f /etc/haproxy/haproxy.cfg -D\n\
|
| 46 |
-
privoxy --no-daemon /etc/privoxy/config' > /entrypoint.sh && chmod +x /entrypoint.sh
|
| 47 |
|
| 48 |
USER 1000
|
| 49 |
-
EXPOSE 7860
|
| 50 |
|
| 51 |
-
CMD ["/entrypoint.sh"]
|
|
|
|
| 1 |
+
FROM debian:bullseye-slim [cite: 1]
|
| 2 |
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive [cite: 1]
|
| 4 |
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
tor \
|
| 7 |
haproxy \
|
| 8 |
privoxy \
|
| 9 |
procps \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# Création du dossier pour Tor
|
| 13 |
+
RUN mkdir -p /tmp/tor && chown -R 1000:1000 /tmp/tor && chmod -R 777 /tmp/tor
|
| 14 |
+
|
| 15 |
+
# Configuration de Privoxy pour écouter sur 7860 et envoyer vers HAProxy (8888)
|
| 16 |
+
RUN echo "listen-address 0.0.0.0:7860\ntoggle 1\nenable-remote-toggle 0\nenable-remote-http-toggle 0\nenable-edit-actions 0\nenforce-blocks 0\nbuffer-limit 4096\nforward-socks5t / 127.0.0.1:8888 ." > /etc/privoxy/config [cite: 1, 2]
|
| 17 |
+
|
| 18 |
+
# On copie ton fichier haproxy.cfg personnalisé au lieu de le générer par un "echo"
|
| 19 |
+
COPY haproxy.cfg /etc/haproxy/haproxy.cfg
|
| 20 |
+
|
| 21 |
+
# Script de démarrage corrigé pour 10 instances Tor
|
| 22 |
RUN echo '#!/bin/bash\n\
|
| 23 |
+
for i in {0..9};\n\
|
| 24 |
+
do\n\
|
| 25 |
port=$((9050 + i))\n\
|
| 26 |
mkdir -p /tmp/tor/$i\n\
|
| 27 |
tor --SocksPort $port --DataDirectory /tmp/tor/$i --RunAsDaemon 1\n\
|
| 28 |
done\n\
|
| 29 |
haproxy -f /etc/haproxy/haproxy.cfg -D\n\
|
| 30 |
+
privoxy --no-daemon /etc/privoxy/config' > /entrypoint.sh && chmod +x /entrypoint.sh
|
| 31 |
|
| 32 |
USER 1000
|
| 33 |
+
EXPOSE 7860 7861 [cite: 3, 4]
|
| 34 |
|
| 35 |
+
CMD ["/entrypoint.sh"]
|