first commit

This commit is contained in:
2025-03-11 17:40:10 +03:00
commit 2c79a515d8
4 changed files with 104 additions and 0 deletions

23
docker/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
FROM debian:testing-slim
SHELL [ "/bin/sh", "-eux", "-c" ]
RUN apt-get update \
&& apt-get install -y --no-install-recommends yggdrasil wget ca-certificates unzip libcap2-bin gosu ;\
apt-get clean ;\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN PU_VERSION="$(wget --server-response https://github.com/ygguser/peers_updater/releases/latest 2>&1 \
| grep -E -m1 'Location: ' \
| cut -d'/' -f8)" ;\
wget https://github.com/ygguser/peers_updater/releases/download/$PU_VERSION/x86_64-unknown-linux-gnu.zip ;\
unzip -d /usr/local/bin/ x86_64-unknown-linux-gnu.zip ;\
rm x86_64-unknown-linux-gnu.zip
# Set file capability to run as regular user
RUN setcap cap_net_admin=eip /usr/sbin/yggdrasil
COPY ./run.sh /usr/local/bin/run.sh
CMD ["/usr/local/bin/run.sh"]

26
docker/run.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
if ! [ -d /var/run/yggdrasil ]
then
install -d -o yggdrasil -g yggdrasil /run/yggdrasil /var/run/yggdrasil
fi
if ! [ -f /etc/yggdrasil/yggdrasil.conf ]
then
mkdir -p /etc/yggdrasil/
yggdrasil -genconf > /etc/yggdrasil/yggdrasil.conf
fi
# Show node address
until yggdrasilctl getself | grep -v "^[[:digit:]]"
do
sleep 5
done &
peers_updater --config /etc/yggdrasil/yggdrasil.conf --update_cfg --number 5
gosu yggdrasil /usr/sbin/yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf