Closed cybervagabond closed 4 years ago
I made one for testing https://hub.docker.com/r/julyighor/telegram-bot-api
I also made one, It take 30 minutes to build telegram-bot-api
. Image size ~40MB.
FROM alpine:3.7 as builder
WORKDIR /server
RUN apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake
RUN git clone --recursive https://github.com/tdlib/telegram-bot-api.git
RUN mkdir ./telegram-bot-api/build
RUN cd ./telegram-bot-api/build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
RUN cd ./telegram-bot-api/build && \
cmake --build . --target install
RUN strip telegram-bot-api/bin/telegram-bot-api
FROM alpine:3.7
RUN apk add --update openssl libstdc++
COPY --from=builder /server/telegram-bot-api/bin/telegram-bot-api /bin/telegram-bot
ENTRYPOINT ["/bin/telegram-bot"]
To build your own:
docker build . --tag=telegram-bot-api
docker run -it telegram-bot-api
I also made one, It take 30 minutes to build
telegram-bot-api
. Image size ~40MB.FROM alpine:3.7 as builder WORKDIR /server RUN apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake RUN git clone --recursive https://github.com/tdlib/telegram-bot-api.git RUN mkdir ./telegram-bot-api/build RUN cd ./telegram-bot-api/build && \ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. RUN cd ./telegram-bot-api/build && \ cmake --build . --target install FROM alpine:3.7 RUN apk add --update openssl libstdc++ COPY --from=builder /server/telegram-bot-api/bin/telegram-bot-api /telegram-bot-api ENTRYPOINT ["/telegram-bot-api"]
To build your own:
docker build . --tag=telegram-bot-api docker run -it telegram-bot-api
Looks similar to mine. Are you sure that ca-certificates is not required?
@cybervagabond If you want to build the Telegram Bot API server and run it using Docker, just do that. There can't be a Dockerfile that fits everyone needs. From the other side, writing a Dockerfile for the Telegram Bot API server is very simple and straightforward. So creation of the Dockerfile will be left for the server owner.
@JulyIghor CA certificates will be needed for a TLS termination proxy like Nginx, which should be used to handle remote HTTPS requests.
@cybervagabond If you want to build the Telegram Bot API server and run it using Docker, just do that. There can't be a Dockerfile that fits everyone needs. From the other side, writing a Dockerfile for the Telegram Bot API server is very simple and straightforward. So creation of the Dockerfile will be left for the server owner.
I think it is all about simplifying updates, if a build instructions changed, it will requires more time for update. And if there is a official docker hub image (with multi arch support), that is updated automatically, it makes a life much more easier.
@JulyIghor CA certificates will be needed for a TLS termination proxy like Nginx, which should be used to handle remote HTTPS requests.
Thats right, so requests to a telegram api servers isn't TLS encrypted?
they use the MTProto Mobile Protocol I assume. https://core.telegram.org/mtproto
they use the MTProto Mobile Protocol I assume. https://core.telegram.org/mtproto
If so, there could be much more possibilities of that bot than just using public bot API.
I also made one, It take 30 minutes to build
telegram-bot-api
. Image size ~40MB.
You will get much less size if used strip /telegram-bot-api
Mine image compressed size is 12.47 MB
@JulyIghor Build instructions are very unlikely to change and even they do, they can still be copypasted from the build instructions generator.
Requests to Telegram Bot API server hosted on api.telegram.org must be TLS-encrypted.
Requests from Telegram Bot API server to Telegram servers are MTProto-encrypted.
much more possibilities of that bot than just using public bot API.
no. checkout #1 for that discussion
I also made one, It take 30 minutes to build
telegram-bot-api
. Image size ~40MB.You will get much less size if used
strip /telegram-bot-api
Mine image compressed size is 12.47 MB
ya, I forgot to use strip. 😄
Also, we should use upx, too.
upx -q -9 /telegram-bot-api
Also, we should use upx, too.
upx -q -9 /telegram-bot-api
I don't think so, we will get both compressed and uncompressed binaries loaded in RAM And longer time to start. strip - just removing debug symbols, since we are not going to debug the binary they are useless anyway
Hello. While we are waiting for the official image, you can use ours: ghcr.io/bots-house/docker-telegram-bot-api:latest
. Repository and examples: bots-house/docker-telegram-bot-api
UPD1: add tagged builds UPD2: add auto rebuild when someone push to upstream repo
To answer original question, yes, it should be dockerized. But given that there can't be a Dockerfile that fits everyone needs, it is better created by the server owner. At the worst, if the owner wants to use Docker, but can't write a very simple Dockerfile, then one of dozens Dockerfile created and mantained by others can be used.
For now we wouldn't add an official Dockerfile, but such a file can be added in the future.
For now we wouldn't add an official Dockerfile, but such a file can be added in the future.
Will you publish official docker image here https://hub.docker.com anytime soon?
@JulyIghor There are no plans to do that in the near future.
@JulyIghor There are no plans to do that in the near future.
ok, so we have a big chance that some third party devs will make docker hub repo which will become very popular
@JulyIghor Do you see any problem with that? If it is a good enough repo and its owner is trusted, why it shouldn't be popular?
@JulyIghor Do you see any problem with that? If it is a good enough repo and its owner is trusted, why it shouldn't be popular?
Less third parties involved in a project, more secure it is. More parties we have to trust, more chances for a problems. They may delay updates sometimes, or stop releasing updates one day and do not notify users. So dealing with the only official source, Telegram, is the best possible option for me. And I'll be happy to get a official repo any time in future.
Just added Github Actions on this project, then it will auto build an alpine docker for every update.
Just added Github Actions on this project, then it will auto build an alpine docker for every update.
where?
Awesome! If someone would be run bot-api on cloud native environment pull requests with Dockerfiles will be accepted or users must implement it on their side?