build(docker): centos7 EOL #546
Workflow file for this run
This file contains 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
# This workflow make compile docker image for OpenMLDB | |
name: HybridSQL Docker | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/hybridsql-docker.yml | |
- docker/Dockerfile | |
- docker/**/*.sh | |
tags: | |
- 'v*.*.*' | |
# Run tests for any PRs. | |
pull_request: | |
paths: | |
- .github/workflows/hybridsql-docker.yml | |
- docker/Dockerfile | |
- docker/**/*.sh | |
workflow_dispatch: | |
env: | |
DOCKERHUB_REPO: 4pdosc | |
IMAGE_NAME: hybridsql | |
jobs: | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} | |
${{ env.DOCKERHUB_REPO }}/${{ env.IMAGE_NAME }} | |
flavor: | |
# turn latest=false to avoid generate latest tag for any 'docker-*' tag push event | |
# refer https://github.com/docker/metadata-action#latest-tag | |
latest=false | |
# expected tag results by trigger event | |
# 1. tag v0.4.1 -> [0.4, 0.4.1] | |
# 2. push to main -> latest | |
# 3. pull request -> pull request name (won't publish) | |
# 4. workflow_dispatch -> workflow_dispatch (won't publish) | |
tags: | | |
# tagging rules, means in order(event -> result tag): | |
# 1. push tag v0.4.1 -> 0.4.1 | |
# 2. push tag v0.4.1 -> 0.4 | |
# 3. pull request -> pull request name | |
# 4. push to main -> latest | |
# 5. workflow_dispatch -> workflow_dispatch | |
type=ref,event=pr | |
type=match,pattern=v(.*),group=1 | |
type=match,pattern=v(\d.\d),group=1 | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=raw,value=workflow_dispatch,enable=${{ github.event_name == 'workflow_dispatch' }} | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name == 'push' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
if: ${{ github.event_name == 'push' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build And Push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: docker | |
push: ${{ github.event_name == 'push' }} | |
platforms: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |