-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (25 loc) · 1.04 KB
/
Dockerfile
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
# Use Debian Buster Slim as the base image
FROM debian:bookworm-slim
# Install necessary packages: Tor, Python3, pip for Python3, cron, and haproxy
RUN apt-get update && apt-get install -y tor python3 python3-pip cron haproxy net-tools privoxy python3.11-venv
# Set working directory
WORKDIR /app
# Copy the script to generate Tor configurations
COPY scripts/generate_configs.sh /app/generate_configs.sh
RUN chmod +x /app/generate_configs.sh
# Add the Python script for rotating identity
COPY scripts/rotate_identity.py /app/
RUN chmod +x /app/rotate_identity.py
# Add a startup script to start services
COPY scripts/startup.sh /app/startup.sh
RUN chmod +x /app/startup.sh
# Create a virtual environment and install stem
RUN python3 -m venv myenv && \
. myenv/bin/activate && \
pip install stem
# Set up the cron job to rotate the Tor identity
RUN echo "* * * * * python3 /app/rotate_identity.py >> /var/log/cron.log 2>&1" > tempcronjob && \
crontab tempcronjob && \
rm tempcronjob
# Command to run the startup script
CMD ["/app/startup.sh"]