2491: Improve Docker CIs r=curquiza a=curquiza

Close #1901 

Continuing work of 

- [x] Merge two docker CI in one (#2477). The latest tag is still only push for the official release.
- [x] Add cron job in GHA to run the CI (without publishing the image) every day. This will check the docker build is working.

Co-authored-by: Lawrence Chou <lawrencechou1024@gmail.com>
Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com>
Co-authored-by: Clémentine Urquizar <clementine@meilisearch.com>
This commit is contained in:
bors[bot] 2022-06-09 11:26:12 +00:00 committed by GitHub
commit 680606fd82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 34 deletions

View File

@ -1,13 +1,17 @@
---
on:
schedule:
- cron: '0 4 * * *' # Every day at 4:00am
push:
tags:
- '*'
release:
types: [released]
name: Publish tagged image to Docker Hub
name: Publish tagged images to Docker Hub
jobs:
docker-tag:
docker:
runs-on: docker
steps:
- name: Set up QEMU
@ -17,6 +21,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'schedule'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
@ -27,13 +32,18 @@ jobs:
uses: docker/metadata-action@v3
with:
images: getmeili/meilisearch
# The lastest tag is only pushed for the official Meilisearch release
# See https://github.com/docker/metadata-action#latest-tag
flavor: latest=false
tags: type=ref,event=tag
tags: |
type=ref,event=tag
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
# We do not push tags for the cron jobs, this is only for test purposes
push: ${{ github.event_name != 'schedule' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}

View File

@ -1,30 +0,0 @@
---
on:
release:
types: [released]
name: Publish latest image to Docker Hub
jobs:
docker-latest:
runs-on: docker
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: getmeili/meilisearch:latest