Update README

This commit is contained in:
Lukasz Raczylo 2020-12-28 09:48:01 +00:00
parent 291916ed13
commit eaa995a1aa
No known key found for this signature in database
GPG Key ID: 4C68D09621D47E6B

View File

@ -32,10 +32,41 @@ jobs:
uses: docker/setup-buildx-action@v1 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 DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/tdlib-telegram-bot-api-docker/telegram-api-server
export SET_DOCKER_REGISTRY="docker.pkg.github.com" VERSION=edge
export BASE_IMG_NAME="$SET_DOCKER_REGISTRY/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server" if [[ $GITHUB_REF == refs/tags/* ]]; then
docker login $SET_DOCKER_REGISTRY -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" VERSION=${GITHUB_REF#refs/tags/v}
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 . fi
docker push "$BASE_IMG_NAME" if [ "${{ github.event_name }}" = "schedule" ]; then
docker push "$BASE_IMG_NAME:latest" VERSION=nightly
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
TAGS="$TAGS,$DOCKER_IMAGE:${{ env.GITHUB_SHA }},$DOCKER_IMAGE:1.0.${{ env.GITHUB_RUN_ID }},$DOCKER_IMAGE:latest"
echo ::set-output name=tags::${TAGS}
# lowercase the branch name
BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
LABELS="org.opencontainers.image.revision=$GITHUB_SHA"
LABELS="$LABELS,org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LABELS="$LABELS,org.opencontainers.image.version=$VERSION"
LABELS="$LABELS,com.github.repo.branch=$BRANCH"
LABELS="$LABELS,com.github.repo.dockerfile=Dockerfile"
echo ::set-output name=labels::${LABELS}
BUILD_ARGS="BRANCH=$BRANCH"
echo ::set-output name=args::${BUILD_ARGS}
- name: Tag names
run: echo ${{ steps.prep.outputs.tags }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api
file: /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api/Dockerfile
platforms: linux/arm64,linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
build-args: ${{ steps.prep.outputs.args }}
labels: ${{ steps.prep.outputs.labels }}