-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
83 lines (56 loc) · 1.88 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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
ARG VERSION=0.4.7.13
ARG USER=toruser
ARG UID=1000
ARG DIR=/data
FROM debian:11-slim as preparer-base
RUN apt update
RUN apt -y install gpg gpg-agent curl
# Add tor key
ENV KEYS 514102454D0A87DB0767A1EBBE6A0531C18A9179 B74417EDDF22AC9F9E90F49142E86A2A11F48D36 7A02B3521DC75C542BA015456AFEE6D49E92B601
#RUN curl -s https://openpgpkey.torproject.org/.well-known/openpgpkey/torproject.org/hu/kounek7zrdx745qydx6p59t9mqjpuhdf |gpg --import -
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys $KEYS
RUN gpg --list-keys | tail -n +3 | tee /tmp/keys.txt && \
gpg --list-keys $KEYS | diff - /tmp/keys.txt
FROM preparer-base AS preparer-release
ARG VERSION
ADD https://dist.torproject.org/tor-$VERSION.tar.gz.sha256sum.asc ./
ADD https://dist.torproject.org/tor-$VERSION.tar.gz.sha256sum ./
ADD https://dist.torproject.org/tor-$VERSION.tar.gz ./
RUN gpg --verify tor-$VERSION.tar.gz.sha256sum.asc
RUN sha256sum -c tor-$VERSION.tar.gz.sha256sum
# Extract
RUN tar -xzf "/tor-$VERSION.tar.gz" && \
rm -f "/tor-$VERSION.tar.gz"
FROM preparer-release AS preparer
FROM debian:11-slim as builder
ARG VERSION
RUN apt update
RUN apt -y install libevent-dev libssl-dev zlib1g-dev build-essential
WORKDIR /tor-$VERSION/
COPY --from=preparer /tor-$VERSION/ ./
RUN ./configure --sysconfdir=/etc --datadir=/var/lib
RUN make -j$(nproc)
RUN make install
RUN ls -la /etc
RUN ls -la /etc/tor
RUN ls -la /var/lib
RUN ls -la /var/lib/tor
FROM debian:11-slim as final
ARG VERSION
ARG USER
ARG DIR
LABEL maintainer="nolim1t (@nolim1t)"
# Libraries (linked)
COPY --from=builder /usr/lib /usr/lib
# Copy all the TOR files
COPY --from=builder /usr/local/bin/tor* /usr/local/bin/
# NOTE: Default GID == UID == 1000
RUN adduser --disabled-password \
--home "$DIR/" \
--gecos "" \
"$USER"
USER $USER
VOLUME /etc/tor
VOLUME /var/lib/tor
EXPOSE 9050 9051 29050 29051
ENTRYPOINT ["tor"]