Skip to content

Instantly share code, notes, and snippets.

@FabianPastor
Created November 16, 2018 14:59
Show Gist options
  • Save FabianPastor/dd590bbcac98330e522d5620c65aac03 to your computer and use it in GitHub Desktop.
Save FabianPastor/dd590bbcac98330e522d5620c65aac03 to your computer and use it in GitHub Desktop.
Docker Container for tdlib development
FROM debian:sid-slim
LABEL maintainer="FabianPastor" \
version="0.1" \
description="Dockerfile for building Telegram TDLib"
RUN apt-get update \
&& apt-get install -y --force-yes git build-essential gcc-5 g++-5 cmake \
gperf openssl libssl-dev ccache zlib1g-dev libreadline-dev \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 60
RUN mkdir -p /src \
&& cd /src \
&& git clone --recursive https://github.com/tdlib/td.git \
&& mkdir -p /src/td/build
ENV buidtype=${buidtype:-Release}
ENTRYPOINT cd /src/td/build \
&& cmake -DCMAKE_BUILD_TYPE=$buidtype .. \
&& cmake --build . \
&& make -j $(nproc) \
&& chown -R 1000:1000 /src
default_target: run
PROJECT = tdlib
VERSION = 1.0
NAME = tdlib-build
DOCKER_ARGS = --rm --cpus=0.000 --name $(NAME) -v $(PWD)/src:/src $(PROJECT):$(VERSION)
init: build cp run
build:
sudo docker build ./ -t $(PROJECT):$(VERSION)
rebuild:
sudo docker build ./ -t $(PROJECT):$(VERSION) --no-cache
rm-build:
sudo docker image rm $(PROJECT):$(VERSION)
runit:
sudo docker run -it $(DOCKER_ARGS) --entrypoint="/bin/bash"
run: run-release
run-debug:
sudo docker run --env buildtype=Debug $(DOCKER_ARGS)
run-release:
sudo docker run --env buildtype=Release $(DOCKER_ARGS)
rm: rm-container
rm-container:
sudo docker container rm $(NAME)
attach:
sudo docker attach $(NAME)
exec:
sudo docker exec -it $(NAME) /bin/bash
kill:
sudo docker container rm -f $(NAME)
list:
sudo docker images
sudo docker container ls -a
logs:
sudo docker logs $(NAME)
cp:
mkdir -p src
sudo docker run -it --entrypoint="/bin/bash -c exit" --name $(NAME) $(PROJECT):$(VERSION) || echo "Nothing to worry about"
sudo docker cp $(NAME):/src $(PWD)
sudo docker container rm -f $(NAME)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment