From b7c1bc8bc91b292d2408d5103e451685594e53ca Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Apr 2020 16:13:56 +0000 Subject: [PATCH] first version --- Dockerfile | 15 +++++++++++++++ docker-entrypoint.sh | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Dockerfile create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01a27f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:buster +WORKDIR /data +COPY docker-entrypoint.sh /usr/bin +RUN apt update \ + && apt install -y git curl build-essential libssl-dev zlib1g-dev xxd \ + && git clone https://github.com/TelegramMessenger/MTProxy /MTProxy \ + && cd /MTProxy \ + && make \ + && cp objs/bin/mtproto-proxy /usr/bin \ + && curl -s https://core.telegram.org/getProxySecret -o /proxy-secret \ + && curl -s https://core.telegram.org/getProxyConfig -o /proxy-multi.conf +EXPOSE 4443 +EXPOSE 8888 +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["mtproto"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..31c2061 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +if [ "$1" = "mtproto" ]; then + if [ ! -f "/data/secret" ]; then + echo "Geaerate secret ::" + head -c 16 /dev/urandom | xxd -ps | tee /data/secret + fi + exec /usr/bin/mtproto-proxy -u nobody -p 8888 -H 4443 -6 -S `cat /data/secret` --aes-pwd /proxy-secret /proxy-multi.conf -M 1 +fi + +exec "$@"