Add multiarch builds for raspberry pi.

This commit is contained in:
Lukasz Raczylo 2020-12-27 19:42:54 +00:00
parent 733701b14a
commit 19b9b1de12
No known key found for this signature in database
GPG Key ID: 4C68D09621D47E6B
2 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,8 @@
name: Build Telegram API server name: Build Telegram API server
on: on:
workflow_dispatch:
schedule: schedule:
- cron: "0 2 */7 * *" - cron: "0 2 */7 * *"
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -25,12 +26,16 @@ jobs:
run: | run: |
echo "GITHUB_SHA=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV echo "GITHUB_SHA=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
echo "GITHUB_RUN_ID=$(echo ${GITHUB_RUN_NUMBER})" >> $GITHUB_ENV echo "GITHUB_RUN_ID=$(echo ${GITHUB_RUN_NUMBER})" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker image - name: Build Docker image
run: | run: |
cd /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api cd /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api
export SET_DOCKER_REGISTRY="docker.pkg.github.com" export SET_DOCKER_REGISTRY="docker.pkg.github.com"
export BASE_IMG_NAME="$SET_DOCKER_REGISTRY/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server" export BASE_IMG_NAME="$SET_DOCKER_REGISTRY/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server"
docker login $SET_DOCKER_REGISTRY -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" docker login $SET_DOCKER_REGISTRY -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}"
docker build -t $BASE_IMG_NAME:${{ env.GITHUB_SHA }} -t $BASE_IMG_NAME:1.0.${{ env.GITHUB_RUN_ID }} -t $BASE_IMG_NAME:latest . docker buildx build --platform linux/arm64,linux/amd64 -t $BASE_IMG_NAME:${{ env.GITHUB_SHA }} -t $BASE_IMG_NAME:1.0.${{ env.GITHUB_RUN_ID }} -t $BASE_IMG_NAME:latest .
docker push "$BASE_IMG_NAME" docker push "$BASE_IMG_NAME"
docker push "$BASE_IMG_NAME:latest" docker push "$BASE_IMG_NAME:latest"

View File

@ -5,6 +5,8 @@ Produce working, minimal Docker image for the Telegram Bot API server together w
to use pipeline generating builds on the changes within the main repository managed by to use pipeline generating builds on the changes within the main repository managed by
Telegram team. Telegram team.
This project does not modify any part of the [tdlib/telegram-bot-api](https://github.com/tdlib/telegram-bot-api) code.
## Build schedule ## Build schedule
Build will be triggered automatically once a week to produce the latest version of the Telegram API Server. Build will be triggered automatically once a week to produce the latest version of the Telegram API Server.
I would set it for the daily release but every build takes ~25 minutes and generates additional costs on my side. I would set it for the daily release but every build takes ~25 minutes and generates additional costs on my side.
@ -12,8 +14,12 @@ Images are versioned in format `1.0.x` where `x` is a build number.
## How to use the image ## How to use the image
Images created within this project support following architectures: AMD64 and ARM64
Yes, it means you can run them on *Raspberry Pi 4* and above as well! 🥳
### Github authentication ### Github authentication
You need to authenticate with github [see this thread](https://github.community/t/docker-pull-from-public-github-package-registry-fail-with-no-basic-auth-credentials-error/16358/87) to pull even the publicly available images. To do so you need to create [Personal Access Token](https://github.com/settings/tokens/new) with `read:packages` scope and use it to authenticate your docker client with the Github Docker Registry. You need to authenticate with github ([see this thread](https://github.community/t/docker-pull-from-public-github-package-registry-fail-with-no-basic-auth-credentials-error/16358/87)) to pull even the publicly available images. To do so you need to create [Personal Access Token](https://github.com/settings/tokens/new) with `read:packages` scope and use it to authenticate your docker client with the Github Docker Registry.
``` ```
docker login -u $GITHUB_USERNAME -p $GITHUB_TOKEN docker.pkg.github.com docker login -u $GITHUB_USERNAME -p $GITHUB_TOKEN docker.pkg.github.com