diff options
author | romik-g <romik-g@users.noreply.github.com> | 2017-02-06 19:16:48 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-16 10:17:16 +0000 |
commit | 6fc0be514250fd8990c4393097002ad2b0101232 (patch) | |
tree | f4c5650b24ed3c0df13e8bcf2692f7debec9a408 /other/bootstrap_daemon/docker | |
parent | ae6250c7af98b8f8656194662d48090c171d6a80 (diff) |
Add Alpine Linux Dockerfile
Diffstat (limited to 'other/bootstrap_daemon/docker')
-rw-r--r-- | other/bootstrap_daemon/docker/Dockerfile.alpine | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/docker/Dockerfile.alpine b/other/bootstrap_daemon/docker/Dockerfile.alpine new file mode 100644 index 00000000..2d15c846 --- /dev/null +++ b/other/bootstrap_daemon/docker/Dockerfile.alpine | |||
@@ -0,0 +1,73 @@ | |||
1 | # Tox network node | ||
2 | FROM alpine:latest | ||
3 | LABEL Description="This image is used to run Tox network node" Vendor="n/a" Version="0.0.0" | ||
4 | |||
5 | # Tox core code | ||
6 | ADD https://github.com/TokTok/c-toxcore/archive/master.zip /tmp/tox/ | ||
7 | |||
8 | WORKDIR /tmp/tox | ||
9 | |||
10 | RUN set -x && \ | ||
11 | # Disable root | ||
12 | sed -i 's/^root::/root:!:/' /etc/shadow && \ | ||
13 | # Add tox user and group, create home directory | ||
14 | addgroup -S tox-bootstrapd && \ | ||
15 | adduser -h /var/lib/tox-bootstrapd -g "Account to run Tox's DHT bootstrap daemon" -s /sbin/nologin -G tox-bootstrapd -S -D -H tox-bootstrapd && \ | ||
16 | install -d -o tox-bootstrapd -g tox-bootstrapd -m 700 /var/lib/tox-bootstrapd && \ | ||
17 | function su_wrapper () { su -s /bin/sh -c "$@" tox-bootstrapd; return $?; } && \ | ||
18 | # Install libs and build tools | ||
19 | apk --no-cache add libsodium libconfig && \ | ||
20 | apk --no-cache add --virtual build-dependencies \ | ||
21 | autoconf \ | ||
22 | automake \ | ||
23 | check-dev \ | ||
24 | curl \ | ||
25 | build-base \ | ||
26 | libtool \ | ||
27 | libconfig-dev \ | ||
28 | libsodium-dev \ | ||
29 | libvpx-dev \ | ||
30 | linux-headers \ | ||
31 | opus-dev \ | ||
32 | python3 \ | ||
33 | unzip && \ | ||
34 | # Unzip | ||
35 | chown tox-bootstrapd:tox-bootstrapd /tmp/tox && \ | ||
36 | chmod 644 /tmp/tox/master.zip && \ | ||
37 | su_wrapper "unzip -tq master.zip" && \ | ||
38 | su_wrapper "unzip -aq master.zip" && \ | ||
39 | # Compile | ||
40 | cd c-toxcore-master && \ | ||
41 | su_wrapper "./autogen.sh" && \ | ||
42 | su_wrapper "./configure --prefix=/usr --enable-daemon --disable-av --disable-ntox" && \ | ||
43 | su_wrapper "make" && \ | ||
44 | # Run tests (they FAIL mostly if you don't have enough compute resources) | ||
45 | # for i in $(seq 1 10); do echo "=== check attempt $i ==="; su_wrapper "make check"; ret=$?; echo "=== check returned $ret ==="; if [ $ret -eq 0 ]; then echo "=== check passed ==="; break; elif [ $i -eq 10 ]; then echo "=== too many failures, aborting ==="; exit 1; fi; done && \ | ||
46 | # | ||
47 | # Install tox daemon and copy base network node configuration file | ||
48 | make install && \ | ||
49 | install -o root -g root -m 644 other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf && \ | ||
50 | # Remove all the example bootstrap nodes from the config file and add nodes to bootstrap from | ||
51 | sed -i '/^bootstrap_nodes = /,$d' /etc/tox-bootstrapd.conf && \ | ||
52 | python3 other/bootstrap_daemon/docker/get-nodes.py >> /etc/tox-bootstrapd.conf && \ | ||
53 | # Clean build dependencies and build files | ||
54 | cd / && \ | ||
55 | rm -rf /tmp/tox && \ | ||
56 | apk del build-dependencies && \ | ||
57 | # Tox network node daemon configuration | ||
58 | # Disable LAN discovery, because we are on a server | ||
59 | sed -i 's/enable_lan_discovery = true/enable_lan_discovery = false/' /etc/tox-bootstrapd.conf && \ | ||
60 | # MOTD | ||
61 | sed -i 's/motd = "tox-bootstrapd"/motd = "tox-bootstrapd docker"/' /etc/tox-bootstrapd.conf | ||
62 | |||
63 | |||
64 | # Tox daemon home directory | ||
65 | WORKDIR /var/lib/tox-bootstrapd | ||
66 | |||
67 | # Ports | ||
68 | EXPOSE 443/tcp 443/udp 3389/tcp 3389/udp 33445/tcp 33445/udp | ||
69 | |||
70 | # Run cmd | ||
71 | #CMD ["/bin/sh"] | ||
72 | USER tox-bootstrapd | ||
73 | CMD ["/usr/bin/tox-bootstrapd", "--config=/etc/tox-bootstrapd.conf", "--foreground", "--log-backend=stdout"] | ||