| # Base Debian (glibc, compatible HF Spaces) | |
| FROM debian:bookworm-slim | |
| # Install Tor + Privoxy | |
| RUN apt-get update && \ | |
| apt-get install -y tor privoxy && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Configure Tor | |
| RUN printf "SocksPort 9050\nRunAsDaemon 1\nDataDirectory /var/lib/tor\n" > /etc/tor/torrc | |
| # Configure Privoxy to forward HTTP via Tor | |
| RUN printf "listen-address 0.0.0.0:8118\nforward-socks5 / 127.0.0.1:9050 .\n" > /etc/privoxy/config | |
| # Exposer port web du Proxy (on forward ensuite vers 7860) | |
| EXPOSE 7860 | |
| # Entrypoint script | |
| CMD tor & \ | |
| sleep 5 && \ | |
| privoxy --no-daemon /etc/privoxy/config & \ | |
| sleep 3 && \ | |
| # Forward Privoxy (8118) to HF Spaces HTTP port 7860 | |
| socat TCP-LISTEN:7860,fork TCP:127.0.0.1:8118 |