-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.tor-proxy-alpine
61 lines (47 loc) · 1.66 KB
/
Dockerfile.tor-proxy-alpine
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
#####################################################################
FROM alpine:3.20.0 as builder
# Install required packages
RUN apk add --no-cache \
go=1.22.5-r0 \
git=2.45.2-r0
# Build the Snowflake client
RUN git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
WORKDIR /snowflake/client
RUN go get && \
go build
# Use the Alpine image
FROM alpine:3.20.0
LABEL maintainer="Piotr K."
LABEL version="1.0"
LABEL description=""
LABEL vendor=""
# Install required packages
RUN apk add --no-cache \
python3=3.12.3-r1 \
py3-pip=24.0-r2 \
py3-virtualenv=20.26.2-r0 \
tor=0.4.8.12-r0
# Create a virtual environment
RUN virtualenv /venv
# Set the PATH to include the virtual environment
ENV PATH="/venv/bin:${PATH}"
# Install packages
RUN /venv/bin/pip install \
nyx==2.1.0 \
stem==1.8.2 \
configparser==7.0.0
# Replace getargspec with getfullargspec
#
# As per Python 3.11 release notes, getargspec has been removed and replaced by getfullargspec.
# Reference: https://docs.python.org/3.11/whatsnew/3.11.html#removed
#
# The nyx package uses getargspec and is no longer maintained. Therefore, I decided to replace
# the function name instead of creating a new package or forking the project.
RUN find /venv/lib/python3.12/site-packages/nyx -type f -exec sed -i 's/getargspec/getfullargspec/g' {} \;
# Copy the Snowflake binary
COPY --from=builder /snowflake/client/client /usr/bin/snowflake-client
# Copy the scripts
COPY ./bin/tor/get_tor_connection_status.py /etc/tor/scripts/get_tor_connection_status.py
# Run Tor (non-daemon mode)
USER tor
CMD ["tor", "-f", "/etc/tor/torrc", "--RunAsDaemon", "0"]