forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and push lite image to dockerhub from GitHub actions (#68)
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Docker Build Lite | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
|
||
concurrency: | ||
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Lite') | ||
cancel-in-progress: true | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
build_and_push: | ||
name: Build and push vitess/lite Docker images | ||
runs-on: ubuntu-latest # TODO: replace by larger runners | ||
if: github.repository == 'vitessio/vitess' | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
branch: [ latest, mysql57, mysql80, percona57, percona80 ] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push on main | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} | ||
push: true | ||
tags: vitess/lite:${{ matrix.branch }} | ||
|
||
- name: Get the tag name | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Build and push on main | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} | ||
push: true | ||
tags: ${{ (matrix.branch == 'latest') && 'vitess/lite:' + env.TAG_NAME || 'vitess/lite:' + env.TAG_NAME + '-' + matrix.branch }} |