Skip to content

Release docker image #160

Release docker image

Release docker image #160

on:
push:
tags:
- 'v*.*.*'
schedule:
# At 00:00 on Sunday.
- cron: '0 10 * * 0'
workflow_dispatch:
name: Release docker image
env:
# FIXME(zyy17): Would be better to use `gh release list -L 1 | cut -f 3` to get the latest release version tag, but for a long time, we will stay at 'v0.1.0-alpha-*'.
SCHEDULED_BUILD_VERSION_PREFIX: v0.1.0-alpha
# In the future, we can change SCHEDULED_PERIOD to nightly.
SCHEDULED_PERIOD: nightly
jobs:
docker:
name: Build docker image
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'GreptimeTeam' }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to AliCloud Container Registry
uses: docker/login-action@v2
with:
registry: greptime-registry.cn-hangzhou.cr.aliyuncs.com
username: ${{ secrets.ALICLOUD_USERNAME }}
password: ${{ secrets.ALICLOUD_PASSWORD }}
- name: Configure scheduled build image tag # the tag would be ${SCHEDULED_BUILD_VERSION_PREFIX}-YYYYMMDD-${SCHEDULED_PERIOD}
shell: bash
if: github.event_name == 'schedule'
run: |
buildTime=`date "+%Y%m%d"`
SCHEDULED_BUILD_VERSION=${{ env.SCHEDULED_BUILD_VERSION_PREFIX }}-$buildTime-${{ env.SCHEDULED_PERIOD }}
echo "IMAGE_TAG=${SCHEDULED_BUILD_VERSION:1}" >> $GITHUB_ENV
- name: Configure tag # If the release tag is v0.1.0, then the image version tag will be 0.1.0.
shell: bash
if: github.event_name != 'schedule'
run: |
commitShortSHA=`echo ${{ github.sha }} | cut -c1-8`
IMAGE_TAG=$commitShortSHA
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
push: true
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: |
greptime/greptimedb-dashboard:latest
greptime/greptimedb-dashboard:${{ env.IMAGE_TAG }}
greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb-dashboard:latest
greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb-dashboard:${{ env.IMAGE_TAG }}