8000 Merge pull request #1 from tdlight-team/docker · deus-developer/telegram-bot-api@fe3d95f · GitHub
[go: up one dir, main page]

Skip to content

Commit fe3d95f

Browse files
authored
Merge pull request tdlib#1 from tdlight-team/docker
Add dockerfile and github actions script
2 parents 38ec055 + 6eb664a commit fe3d95f

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/docker.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Docker Build + Image Push
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
10+
jobs:
11+
build:
12+
name: Build Image
13+
runs-on: ubuntu-latest
14+
env:
15+
IMAGE_id: docker.pkg.github.com/${{ github.repository }}/${{ github.repository }}
16+
17+
steps:
18+
- name: Checkout current repo
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: true
22+
23+
- name: Get Version
24+
run: |
25+
# get telegram bot api version
26+
telegram_bot_api_version=$(git rev-parse --short HEAD)
27+
28+
# get tdlib version
29+
tdlib_version=$(cd td && git rev-parse --short HEAD)
30+
31+
# concat tdlib and telegram bot api version
32+
version=$telegram_bot_api_version-$tdlib_version
33+
34+
# store variable for future use
35+
echo "version=$version" >> $GITHUB_ENV
36+
37+
- name: Build image
38+
run: |
39+
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ github.repository }}
40+
docker build \
41+
--tag tdlight-team/tdlight-telegram-bot-api:latest \
42+
--tag tdlight-team/tdlight-telegram-bot-api:$version \
43+
.
44+
45+
- name: Login to registry
46+
run: |
47+
echo "${{ secrets.GITHUB_ACCESS_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
48+
49+
50+
- name: Push images
51+
run: |
52+
docker push $IMAGE_ID:$version

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM alpine:3.12.1 as builder
2+
3+
RUN apk --no-cache add \
4+
build-base \
5+
cmake \
6+
openssl-dev \
7+
zlib-dev \
8+
gperf \
9+
linux-headers
10+
11+
COPY . /src
12+
13+
WORKDIR /src/build
14+
15+
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
16+
RUN cmake --build . --target install --
17+
18+
FROM alpine:3.12.1
19+
20+
RUN apk --no-cache add libstdc++
21+
22+
COPY --from=builder /usr/local/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
23+
24+
HEALTHCHECK CMD curl -f http://localhost:8082/ || exit 1
25+
26+
ENTRYPOINT ["/usr/local/bin/telegram-bot-api -s 8082"]

0 commit comments

Comments
 (0)
0