├── circle.yml ├── update.sh ├── telegram@.service ├── Dockerfile ├── tests └── tests.sh └── README.md /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | services: 3 | - docker 4 | 5 | test: 6 | override: 7 | - tests/tests.sh 8 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Gather latest version of telegram 4 | version=$(curl --head https://tdesktop.com/linux/ |grep Location |cut -d '/' -f 5 |cut -d '.' -f 2-4) 5 | sed -i 's/Telegram\ Version\ [0-9]*\.[0-9]*\.[0-9]*$/\Telegram\ Version\ '$version'/' Dockerfile 6 | sed -i 's/tsetup.*.tar.xz\ \-O/tsetup.'$version'.tar.xz\ \-O/' Dockerfile 7 | git commit -am "Telegram version $version" -S 8 | git tag -am "Telegram version $version" $version 9 | git push --follow-tags 10 | -------------------------------------------------------------------------------- /telegram@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Telegram with GUI in a container 3 | Requires=docker.service graphical.target 4 | After=docker.service 5 | Wants=display-manager.service NetworkManager-wait-online.service network-online.target 6 | 7 | [Service] 8 | Environment="XAUTHORITY=/home/%i/.Xauthority" 9 | Environment=DISPLAY=:0 10 | User=%i 11 | ExecStartPre=-/usr/bin/docker pull xorilog/telegram 12 | ExecStartPre=-/usr/bin/docker rm -vf telegram 13 | ExecStartPre=/bin/bash -c "xhost +" 14 | ExecStart=/usr/bin/docker run -i --rm --name telegram -v /etc/localtime:/etc/localtime:ro --ipc="host" -v /dev/shm:/dev/shm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix${DISPLAY} --device /dev/snd --device /dev/snd -v /home/%i/.TelegramDesktop:/root/.TelegramDesktop xorilog/telegram 15 | ExecStop=/usr/bin/docker rm -vf telegram 16 | ExecStop=/bin/bash -c "xhost -" 17 | Restart=on-failure 18 | 19 | [Install] 20 | WantedBy=default.target 21 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Base docker image 2 | FROM debian:jessie 3 | LABEL maintainer "Christophe Boucharlat " 4 | 5 | # Telegram Version 1.1.7 6 | 7 | RUN apt-get update && apt-get install -y \ 8 | apt-utils \ 9 | dbus-x11 \ 10 | dunst \ 11 | hunspell-en-us \ 12 | python3-dbus \ 13 | software-properties-common \ 14 | libx11-xcb1 \ 15 | gconf2 \ 16 | wget \ 17 | --no-install-recommends && \ 18 | apt-get clean && \ 19 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 20 | 21 | 22 | RUN wget https://tdesktop.com/linux/tsetup.1.1.7.tar.xz -O /tmp/telegram.tar.xz && \ 23 | cd /tmp/ && \ 24 | tar xvfJ /tmp/telegram.tar.xz && \ 25 | mv /tmp/Telegram/Telegram /usr/bin/Telegram && \ 26 | rm -rf /tmp/{telegram.tar.xz,Telegram} && \ 27 | rm /etc/fonts/conf.d/10-scale-bitmap-fonts.conf && \ 28 | fc-cache -fv 29 | 30 | ENV QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb 31 | 32 | # Autorun Telegram 33 | CMD ["/usr/bin/Telegram"] 34 | -------------------------------------------------------------------------------- /tests/tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # this is kind of an expensive check, so let's not do this twice if we 5 | # are running more than one validate bundlescript 6 | VALIDATE_REPO='https://github.com/xorilog/docker-telegram.git' 7 | VALIDATE_BRANCH='master' 8 | 9 | VALIDATE_HEAD="$(git rev-parse --verify HEAD)" 10 | 11 | git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH" 12 | VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)" 13 | 14 | VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD" 15 | 16 | validate_diff() { 17 | if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then 18 | git diff "$VALIDATE_COMMIT_DIFF" "$@" 19 | else 20 | git diff HEAD~ "$@" 21 | fi 22 | } 23 | 24 | base="xorilog/telegram" 25 | suite="latest" 26 | build_dir="." 27 | 28 | 29 | # get the dockerfiles changed 30 | IFS=$'\n' 31 | files=( $(validate_diff --name-only -- '*Dockerfile') ) 32 | unset IFS 33 | 34 | ( 35 | set -x 36 | docker build -t ${base}:${suite} ${build_dir} 37 | ) 38 | 39 | echo " --- " 40 | echo "Successfully built ${base}:${suite} with context ${build_dir}" 41 | echo " --- " 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-telegram 2 | A Docker image that start a fresh telegram client. 3 | 4 | [![Circle CI](https://circleci.com/gh/xorilog/docker-telegram.svg?style=shield)](https://circleci.com/gh/xorilog/docker-telegram) 5 | [![Image Layers](https://images.microbadger.com/badges/image/xorilog/telegram.svg)](https://microbadger.com/images/xorilog/telegram) 6 | 7 | 8 | ## Usage 9 | To spawn a new instance of Telegram: 10 | 11 | ```shell 12 | docker run --rm -it --name telegram \ 13 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 14 | -e DISPLAY=unix$DISPLAY \ 15 | --device /dev/snd \ 16 | -v /.TelegramDesktop:/root/.local/share/TelegramDesktop/ \ 17 | xorilog/telegram 18 | ``` 19 | ## Issues 20 | * You have to log out Telegram to close the docker container. 21 | 22 | 23 | ## FAQ 24 | ### Docker <1.8 25 | Before Docker 1.8 you need to replace `--device /dev/snd` by `-v /dev/snd:/dev/snd --privileged`. 26 | 27 | 28 | ### QXcbConnection: Could not connect to display unix:0 29 | ```shell 30 | xhost + 31 | ``` 32 | do not forget to remove it after start or usage (`xhost -`) 33 | The previous command is to be run on a linux machine. But Mac users, I have a special surprise for you. You can also do fun hacks with X11. Details are described [here](https://github.com/docker/docker/issues/8710). 34 | 35 | 36 | Thanks to [Telegram](https://telegram.org/) for their great app ! 37 | --------------------------------------------------------------------------------