forked from equalitie/ouinet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
122 lines (120 loc) · 4.58 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FROM debian:buster AS base
ENV LANG=C.UTF-8
# To get the list of build dependency packages from the Vagrantfile, run:
#
# sed '/# Install toolchain/,/^$/!d' Vagrantfile \
# | sed -En 's/^\s+(\S+)\s*\\?$/\1/p' | sort
#
RUN apt-get update && apt-get install -y \
autoconf \
automake \
autopoint \
build-essential \
cmake \
gettext \
git \
libssl-dev \
libtool \
ninja-build \
pkg-config \
python-twisted \
rsync \
texinfo \
unzip \
wget \
zlib1g-dev
# quieten wget and unzip
RUN echo 'quiet = on' >> /etc/wgetrc
WORKDIR /usr/local/src
FROM base as builder
# This version is a recommendation and this file has been tested to work for it,
# but you may attempt to build other versions by overriding this argument.
# Also see `OUINET_DOCKER_VERSION` below.
ARG OUINET_VERSION=v0.21.6
RUN git clone --recursive -b "$OUINET_VERSION" https://github.com/equalitie/ouinet.git
WORKDIR /opt/ouinet
# The C.UTF-8 locale (which is always available in Debian)
# is needed to allow CMake to extract files in the Go language binary distribution
# with UTF-8-encoded Unicode names.
RUN cmake /usr/local/src/ouinet \
&& make
RUN cp -r /usr/local/src/ouinet/repos/ repo-templates/
ARG OUINET_DEBUG=no
RUN \
if [ $OUINET_DEBUG != yes ]; then \
strip injector client src/ouiservice/obfs4proxy/obfs4proxy test/bt-* test/oui-* \
&& find . -name '*.so' -exec strip '{}' + \
&& find . -wholename '*/libexec/*' -executable -type f -exec strip '{}' + ; \
fi
# Setting this to a different version than `OUINET_VERSION` allows to
# use that version's Docker-specific files (e.g. wrapper scripts)
# without having to rebuild source.
# Maybe those Docker-specific files should go in a different repo.
ARG OUINET_DOCKER_VERSION=$OUINET_VERSION
RUN cd /usr/local/src/ouinet \
&& git fetch -t \
&& git checkout "$OUINET_DOCKER_VERSION"
# Populate the licenses directory (avoid version numbers in source paths).
RUN /usr/local/src/ouinet/scripts/add-licenses-dir.sh /usr/local/src/ouinet .
FROM debian:buster
# To get the list of system library packages to install,
# enter the build directory and execute:
#
# ldd injector client $(find . -name '*.so' | grep -v '\.libs') \
# | sed -En 's#^.* => (/lib/.*|/usr/lib/.*) \(.*#\1#p' | sort -u \
# | (while read l; do dpkg -S $l; done) | cut -f1 -d: | sort -u
#
ARG OUINET_DEBUG=no
# This will also be used by the wrapper script.
ENV OUINET_DEBUG=$OUINET_DEBUG
RUN apt-get update && apt-get install -y \
libc6 \
libgcc1 \
libssl1.1 \
libstdc++6 \
zlib1g \
\
ca-certificates \
$(echo $OUINET_DEBUG | sed -n 's/^yes$/gdb/p') \
\
lsb-release \
netcat-openbsd \
wget \
&& rm -rf /var/lib/apt/lists/*
# Fetch and install i2pd.
ARG I2PD_VERSION=2.23.0
RUN wget -q -P /tmp "https://github.com/PurpleI2P/i2pd/releases/download/${I2PD_VERSION}/i2pd_${I2PD_VERSION}-1$(lsb_release -sc)1_$(dpkg --print-architecture).deb" \
&& apt-get update && apt-get install -y \
cron \
logrotate \
$(dpkg --info /tmp/i2pd_*.deb | sed -nE 's/^.*Depends: (.*)/\1/p' | sed -E 's/( \([^)]+\))?,//g') \
&& dpkg -i /tmp/i2pd_*.deb \
&& rm -f /tmp/i2pd_*.deb \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/ouinet
# Copy locally built libraries (all placed along binaries).
COPY --from=builder /opt/ouinet/lib*.so /usr/local/lib/
# Update the dynamic linker cache after all non-system libraries have been copied.
# This also creates the appropriate symbolic links to those libraries.
RUN ldconfig
# GNUnet support has been temporarily removed.
#COPY --from=builder /opt/ouinet/modules/gnunet-channels/gnunet-bin/share/gnunet/ modules/gnunet-channels/gnunet-bin/share/gnunet/
#COPY --from=builder /opt/ouinet/modules/gnunet-channels/gnunet-bin/lib/ modules/gnunet-channels/gnunet-bin/lib/
COPY --from=builder /opt/ouinet/injector /opt/ouinet/client ./
COPY --from=builder /opt/ouinet/src/ouiservice/obfs4proxy/obfs4proxy ./
COPY --from=builder /opt/ouinet/repo-templates/ repo-templates/
RUN mkdir utils
COPY --from=builder \
/opt/ouinet/test/bt-* /opt/ouinet/test/oui-* \
/usr/local/src/ouinet/scripts/ping-swarm \
utils/
# This ensures that we use the desired Docker-specific files.
RUN echo "$OUINET_DOCKER_VERSION"
COPY --from=builder /usr/local/src/ouinet/scripts/ouinet-wrapper.sh ouinet
COPY --from=builder /opt/ouinet/licenses/ licenses/
# This last step pulls in latest updates to Debian packages
# (only if something changed above)
# since the base image may not have been upgraded in a long while.
RUN apt-get update && apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/opt/ouinet/ouinet"]