Skip to content

Instantly share code, notes, and snippets.

@mojtab23
Last active July 15, 2019 13:14
Show Gist options
  • Save mojtab23/2d69e33d014222dcddda7a7552b18194 to your computer and use it in GitHub Desktop.
Save mojtab23/2d69e33d014222dcddda7a7552b18194 to your computer and use it in GitHub Desktop.
Example docker file with configuring user. Telegram mtproxy dockerfile
FROM alpine:3.6
# Uncomment if local sources
# COPY ./MTProxy /mtproxy/sources
COPY ./patches /mtproxy/patches
RUN apk add --no-cache --virtual .build-deps \
git make gcc musl-dev linux-headers openssl-dev \
&& git clone --single-branch --depth 1 https://github.com/TelegramMessenger/MTProxy.git /mtproxy/sources \
&& cd /mtproxy/sources \
&& patch -p0 -i /mtproxy/patches/randr_compat.patch \
&& make -j$(getconf _NPROCESSORS_ONLN)
# Let's skip all cleaning stuff for faster build
# && cp /mtproxy/sources/objs/bin/mtproto-proxy /mtproxy/ \
# && rm -rf /mtproxy/{sources,patches} \
# && apk add --virtual .rundeps libcrypto1.0 \
# && apk del .build-deps
FROM alpine:3.6
LABEL maintainer="Mojtaba Zare <mojtab.zare@gmail.com>" \
description="Telegram Messenger MTProto zero-configuration proxy server."
RUN apk update \
&& apk add ca-certificates wget \
&& update-ca-certificates
RUN apk add --no-cache curl \
&& ln -s /usr/lib/libcrypto.so.41 /usr/lib/libcrypto.so.1.0.0
# alpine:3.7 will need symlink to libcrypto.so.42
WORKDIR /mtproxy
RUN addgroup -S mtproto && adduser -S mtproto -G mtproto
RUN mkdir -p /home/data
RUN chown -R mtproto:mtproto /home/data
VOLUME /home/data
USER mtproto
COPY --from=0 /mtproxy/sources/objs/bin/mtproto-proxy .
COPY docker-entrypoint.sh /
EXPOSE 2398 9443
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD [ \
"--port", "2398", \
"--http-ports", "9443", \
"--slaves", "2", \
"--max-special-connections", "60000", \
"--allow-skip-dh" \
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment