Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] docker image #65

Open
folt opened this issue Dec 23, 2020 · 9 comments
Open

[Question] docker image #65

folt opened this issue Dec 23, 2020 · 9 comments

Comments

@folt
Copy link

folt commented Dec 23, 2020

Is there an official telegram-bot-api image for docker?
Are there any plans to develop it?
thanks for answers

@folt folt changed the title docker image [Question] docker image Dec 23, 2020
@levlam
Copy link
Contributor

levlam commented Dec 23, 2020

No. See #9 (comment).

@folt
Copy link
Author

folt commented Dec 23, 2020

No. See #9 (comment).

This clarifies the situation.
Maybe you should document this strategy in the documentation?

@levlam
Copy link
Contributor

levlam commented Dec 23, 2020

It is strange to document lack of official support of a third-party tool, even it is so popular as Docker.

@lukaszraczylo
Copy link

lukaszraczylo commented Dec 27, 2020

I managed to build the 54mb docker image with the API server using alpine linux.

Disadvantages:

  • Building docker image requires at least 6GB of RAM
  • Build on 4 CPU + 6GB of RAM takes ~1200 seconds

Pros:

  • Thanks to the multistep build I was able to decrease size from 560MB to 54MB

Will test it for few days and either create PR with Dockerfile or push the image somewhere for everyone to use after I'll set up the build pipeline to sync with changes in this repo :)

@lukaszraczylo
Copy link

lukaszraczylo commented Dec 27, 2020

Update: Well.. There you have it everyone - freshly baked, minimal docker image for the telegram api server.

  • Instructions are in the README
  • I will add cross compiled version for the Raspberry Pi, possibly after the dinner 👍

https://github.com/lukaszraczylo/tdlib-telegram-bot-api-docker

Update: As I have raspberry pi k8s cluster as well - I decided to add images for the Raspberry Pi / ARM64 as well, then stumbled upon few comments of people requesting them.

@CaliforniaMountainSnake

Just an example of telegram-bot-api Dockerfile, 56 MB:

FROM alpine:3.19 as builder
# Compile telegram-bot-api server:
RUN apk update && apk upgrade && \
    apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake && \
    git clone --recursive https://github.com/tdlib/telegram-bot-api.git && \
    cd telegram-bot-api && \
    rm -rf build && \
    mkdir build && \
    cd build && \
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. && \
    cmake --build . --target install

FROM alpine:3.19

# Install dependencies:
RUN apk update && apk upgrade && apk add --update --no-cache \
    zlib-dev openssl-dev libstdc++

# Install telegram-bot-api server:
COPY --from=builder /usr/local/bin/telegram-bot-api /usr/local/bin/

ENTRYPOINT ["telegram-bot-api", "--api-id=${TELEGRAM_API_ID}", "--api-hash=${TELEGRAM_API_HASH}", "--http-port=8080", "--local"]

@ragnarok22
Copy link

@lukaszraczylo I didn't see your repo before and I created one for my self 😅.

I saw #9 this comment and I'm not agree. I think we can create differents images for at least 80% of the users.

I will continue improving my image and adding more options

@levlam
Copy link
Contributor

levlam commented Feb 27, 2024

@ragnarok22 By the way, you Dockerfile also has some drawbacks and is worse than many other already existing Dockerfile. All of them can be fixed for sure.

Anyway, creating a Dockerfile for building the executable is a very simple task given existence of https://tdlib.github.io/telegram-bot-api/build.html, but only the end user knows how they want to run the image using Docker and can create corresponding Dockerfile. For example, see https://github.com/aiogram/telegram-bot-api/blob/master/Dockerfile, which is interoperable with official NGINX Docker image.

@ragnarok22
Copy link

@ragnarok22 By the way, you Dockerfile also has some drawbacks and is worse than many other already existing Dockerfile. All of them can be fixed for sure.

Anyway, creating a Dockerfile for building the executable is a very simple task given existence of https://tdlib.github.io/telegram-bot-api/build.html, but only the end user knows how they want to run the image using Docker and can create corresponding Dockerfile. For example, see https://github.com/aiogram/telegram-bot-api/blob/master/Dockerfile is interoperable with official NGINX Docker image.

Thanks for the feedback. I will use it and improve it over time.

deus-developer pushed a commit to deus-developer/telegram-bot-api that referenced this issue Dec 23, 2024
Fix filter for getChatMembers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants