Skip to content

Commit

Permalink
Use only one workflow to build and push all docker images
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Apr 2, 2024
1 parent 83cfabb commit b24daf8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Build Base
name: Docker Build Images
on:
push:
branches:
Expand All @@ -7,21 +7,21 @@ on:
- '*'

concurrency:
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Base')
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Images')
cancel-in-progress: true

permissions: read-all

jobs:
build_and_push_base:
name: Build and push vitess/base Docker images
build_and_push_lite:
name: Build and push vitess/lite Docker images
runs-on: gh-hosted-runners-16cores-1
if: github.repository == 'vitessio/vitess'

strategy:
fail-fast: true
matrix:
branch: [ latest, mysql57, percona57, percona80 ]
branch: [ latest ]

steps:
- name: Check out code
Expand All @@ -36,9 +36,9 @@ jobs:
- name: Set Dockerfile path
run: |
if [[ "${{ matrix.branch }}" == "latest" ]]; then
echo "DOCKERFILE=./docker/base/Dockerfile" >> $GITHUB_ENV
echo "DOCKERFILE=./docker/lite/Dockerfile" >> $GITHUB_ENV
else
echo "DOCKERFILE=./docker/base/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV
echo "DOCKERFILE=./docker/lite/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV
fi
- name: Build and push on main
Expand All @@ -48,25 +48,26 @@ jobs:
context: .
file: ${{ env.DOCKERFILE }}
push: true
tags: vitess/base:${{ matrix.branch }}
tags: vitess/lite:${{ matrix.branch }}

######
# All code below only applies to new tags
######

- name: Get the Git tag
if: startsWith(github.ref, 'refs/tags/')
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Set Docker tag name
if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest'
if: startsWith(github.ref, 'refs/tags/')
run: |
if [[ "${{ matrix.branch }}" == "latest" ]]; then
echo "DOCKER_TAG=vitess/base:${TAG_NAME}" >> $GITHUB_ENV
echo "DOCKER_TAG=vitess/lite:${TAG_NAME}" >> $GITHUB_ENV
else
echo "DOCKER_TAG=vitess/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV
fi
- name: Build and push on tags
if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest'
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
Expand Down Expand Up @@ -258,4 +259,4 @@ jobs:
tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }}
build-args: |
VT_BASE_VER=${{ env.TAG_NAME }}
DEBIAN_VER=${{ matrix.debian }}-slim
DEBIAN_VER=${{ matrix.debian }}-slim
73 changes: 0 additions & 73 deletions .github/workflows/docker_build_lite.yml

This file was deleted.

0 comments on commit b24daf8

Please sign in to comment.