2020-04-24 00:18:15 +08:00
|
|
|
###########################################################
|
|
|
|
# Builder image: we compile the code here (static build)
|
2021-12-14 12:17:53 +08:00
|
|
|
FROM alpine:3.15.0 AS build
|
2020-04-24 00:18:15 +08:00
|
|
|
|
|
|
|
RUN ["apk", "--no-cache", "add",\
|
|
|
|
"build-base",\
|
|
|
|
"cmake",\
|
|
|
|
"linux-headers",\
|
|
|
|
"libconfig-dev",\
|
|
|
|
"libconfig-static",\
|
|
|
|
"libsodium-dev",\
|
|
|
|
"libsodium-static",\
|
2022-02-08 19:30:59 +08:00
|
|
|
"msgpack-c-dev",\
|
2020-04-24 00:18:15 +08:00
|
|
|
"ninja",\
|
|
|
|
"python3"\
|
|
|
|
]
|
|
|
|
|
|
|
|
WORKDIR /src/c-toxcore
|
|
|
|
|
|
|
|
# Very selectively add files to the image, because we may have random stuff
|
|
|
|
# lying around. In particular, we don't need to rebuild the docker image when
|
|
|
|
# toxav changes or the Dockerfile changes down from the build.
|
|
|
|
COPY cmake cmake
|
2022-02-09 08:16:32 +08:00
|
|
|
COPY other/bootstrap_daemon/bash-completion other/bootstrap_daemon/bash-completion
|
2020-04-24 00:18:15 +08:00
|
|
|
COPY other/bootstrap_daemon/src other/bootstrap_daemon/src
|
|
|
|
COPY other/bootstrap_node_packets.[ch] other/
|
|
|
|
COPY other/DHT_bootstrap.c other/
|
|
|
|
COPY other/pkgconfig other/pkgconfig
|
|
|
|
COPY other/rpm other/rpm
|
|
|
|
COPY testing/misc_tools.[ch] testing/
|
|
|
|
COPY toxcore toxcore
|
|
|
|
COPY toxencryptsave toxencryptsave
|
|
|
|
COPY CMakeLists.txt so.version ./
|
|
|
|
|
2021-12-14 20:27:33 +08:00
|
|
|
RUN cmake -B_build -H. \
|
|
|
|
-GNinja \
|
2022-02-08 19:30:59 +08:00
|
|
|
-DCMAKE_C_FLAGS="-DTCP_SERVER_USE_EPOLL -fstack-protector-all -fisolate-erroneous-paths-attribute" \
|
|
|
|
-DCMAKE_UNITY_BUILD=ON \
|
2021-12-14 20:27:33 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DFULLY_STATIC=ON \
|
2022-02-08 19:30:59 +08:00
|
|
|
-DMIN_LOGGER_LEVEL=DEBUG \
|
2021-12-14 20:27:33 +08:00
|
|
|
-DBUILD_TOXAV=OFF \
|
|
|
|
-DBOOTSTRAP_DAEMON=ON && \
|
|
|
|
cmake --build _build --target install
|
2016-01-02 06:18:37 +08:00
|
|
|
|
2020-04-24 00:18:15 +08:00
|
|
|
# Verify checksum from dev-built binary, so we can be sure Docker Hub doesn't
|
|
|
|
# mess with your binaries.
|
|
|
|
COPY other/bootstrap_daemon/docker/tox-bootstrapd.sha256 other/bootstrap_daemon/docker/
|
2021-12-14 20:27:33 +08:00
|
|
|
RUN sha256sum /usr/local/bin/tox-bootstrapd && \
|
|
|
|
sha256sum -c other/bootstrap_daemon/docker/tox-bootstrapd.sha256
|
2020-04-24 00:18:15 +08:00
|
|
|
|
|
|
|
# Remove all the example bootstrap nodes from the config file.
|
|
|
|
COPY other/bootstrap_daemon/tox-bootstrapd.conf other/bootstrap_daemon/
|
|
|
|
# hadolint ignore=SC2086,SC2154
|
|
|
|
RUN ["sed", "-i", "/^bootstrap_nodes = /,$d", "other/bootstrap_daemon/tox-bootstrapd.conf"]
|
|
|
|
|
|
|
|
# Add bootstrap nodes from https://nodes.tox.chat/.
|
|
|
|
COPY other/bootstrap_daemon/docker/get-nodes.py other/bootstrap_daemon/docker/
|
|
|
|
RUN ["other/bootstrap_daemon/docker/get-nodes.py", "other/bootstrap_daemon/tox-bootstrapd.conf"]
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Final image build: this is what runs the bootstrap node
|
2021-12-14 12:17:53 +08:00
|
|
|
FROM debian:bullseye-slim
|
2016-01-27 23:11:45 +08:00
|
|
|
|
2020-04-24 00:18:15 +08:00
|
|
|
COPY --from=build /usr/local/bin/tox-bootstrapd /usr/local/bin/
|
|
|
|
COPY --from=build /src/c-toxcore/other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
|
2021-12-14 20:27:33 +08:00
|
|
|
RUN useradd --home-dir /var/lib/tox-bootstrapd --create-home \
|
|
|
|
--system --shell /sbin/nologin \
|
|
|
|
--comment "Account to run the Tox DHT bootstrap daemon" \
|
|
|
|
--user-group tox-bootstrapd && \
|
|
|
|
chmod 644 /etc/tox-bootstrapd.conf && \
|
|
|
|
chmod 700 /var/lib/tox-bootstrapd
|
2016-01-27 23:11:45 +08:00
|
|
|
|
2016-02-07 06:51:41 +08:00
|
|
|
WORKDIR /var/lib/tox-bootstrapd
|
2016-01-02 06:18:37 +08:00
|
|
|
|
|
|
|
USER tox-bootstrapd
|
|
|
|
|
2022-02-08 19:30:59 +08:00
|
|
|
# Smoke-test: make sure the binary actually starts up.
|
|
|
|
# hadolint ignore=DL4006
|
|
|
|
RUN script /usr/local/bin/tox-bootstrapd --help | grep "Usage"
|
|
|
|
|
2020-04-24 00:18:15 +08:00
|
|
|
ENTRYPOINT ["/usr/local/bin/tox-bootstrapd",\
|
|
|
|
"--config", "/etc/tox-bootstrapd.conf",\
|
|
|
|
"--log-backend", "stdout",\
|
|
|
|
"--foreground"\
|
|
|
|
]
|
2016-01-02 06:18:37 +08:00
|
|
|
|
2016-02-07 06:51:41 +08:00
|
|
|
EXPOSE 443/tcp 3389/tcp 33445/tcp 33445/udp
|