build: release docker #261
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
| workflow_dispatch: | ||
| name: Release docker image | ||
| 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 tag | ||
| shell: bash | ||
| run: | | ||
| commitShortSHA=`echo ${{ github.sha }} | cut -c1-8` | ||
| IMAGE_TAG=$commitShortSHA | ||
| echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | ||
| # Base tags (always included) | ||
| DOCKERHUB_BASE="greptime/greptimedb-dashboard:${IMAGE_TAG}" | ||
| ALICLOUD_BASE="greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb-dashboard:${IMAGE_TAG}" | ||
| # Check if triggered by tag push (not manual dispatch) | ||
| if [[ "${{ github.event_name }}" == "push" ]]; then | ||
| # Tag release: include latest tag | ||
| echo "DOCKERHUB_TAGS=greptime/greptimedb-dashboard:latest | ||
| ${DOCKERHUB_BASE}" >> $GITHUB_ENV | ||
| echo "ALICLOUD_TAGS=greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb-dashboard:latest | ||
| ${ALICLOUD_BASE}" >> $GITHUB_ENV | ||
| IMAGE_TYPE="Release" | ||
| LATEST_INFO=" - DockerHub: greptime/greptimedb-dashboard:latest | ||
| - AliCloud: greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb-dashboard:latest" | ||
| else | ||
| # Manual dispatch: test image, no latest tag | ||
| echo "DOCKERHUB_TAGS=${DOCKERHUB_BASE}" >> $GITHUB_ENV | ||
| echo "ALICLOUD_TAGS=${ALICLOUD_BASE}" >> $GITHUB_ENV | ||
| IMAGE_TYPE="Test Image" | ||
| LATEST_INFO="" | ||
| fi | ||
| # Output image information | ||
| echo "📦 Docker Image Information (${IMAGE_TYPE}):" | ||
| if [[ -n "$LATEST_INFO" ]]; then | ||
| echo "$LATEST_INFO" | ||
| fi | ||
| echo " - DockerHub: ${DOCKERHUB_BASE}" | ||
| echo " - AliCloud: ${ALICLOUD_BASE}" | ||
| echo "" | ||
| echo "🧪 Test the image with:" | ||
| echo " docker pull ${DOCKERHUB_BASE}" | ||
| echo " docker run -d -p 8080:8080 ${DOCKERHUB_BASE}" | ||
| - 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: | | ||
| ${{ env.DOCKERHUB_TAGS }} | ||
| ${{ env.ALICLOUD_TAGS }} | ||