Publish AIFlow Docker Image #797
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
name: Publish AIFlow Docker Image | |
on: | |
workflow_dispatch: | |
inputs: | |
image_repository: | |
description: 'Image Repository' | |
required: false | |
default: 'flinkaiflow/flink-ai-flow-dev' | |
image_tag: | |
description: 'Image Tag' | |
required: false | |
default: '' | |
schedule: | |
- cron: '0 16 * * *' | |
jobs: | |
push_to_registry: | |
name: Push Docker image | |
if: github.repository == 'flink-extended/ai-flow' # Don't do this in forks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set variables | |
env: | |
DEFAULT_IMAGE_REPO: 'flinkaiflow/flink-ai-flow-dev' | |
run: | | |
IMAGE_REPO=${{ github.event.inputs.image_repository || env.DEFAULT_IMAGE_REPO }} | |
IMAGE_TAG=${{ github.event.inputs.image_tag }} | |
AUTO_BUILD_LATEST=false | |
[ -z ${IMAGE_TAG} ] && [ ${IMAGE_REPO} = ${{ env.DEFAULT_IMAGE_REPO }} ] && AUTO_BUILD_LATEST=true | |
[ -z ${IMAGE_TAG} ] && IMAGE_TAG=${GITHUB_REF##*/}-`echo ${GITHUB_SHA} | cut -c1-8` | |
echo "IMAGE_REPO=${IMAGE_REPO}" >> $GITHUB_ENV | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | |
echo "AUTO_BUILD_LATEST=${AUTO_BUILD_LATEST}" >> $GITHUB_ENV | |
- name: Log in to to docker registry | |
run: | | |
docker login --username=${{ secrets.IMAGE_REGISTRY_USERNAME }} --password=${{ secrets.IMAGE_REGISTRY_PASSWORD }} ${{ secrets.LOGIN_REGISTRY }} | |
- name: Build Image | |
run: | | |
echo building image with repo: ${{ env.IMAGE_REPO }} tag: ${{ env.IMAGE_TAG }} | |
bash build_docker_image.sh ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
- name: Push Image | |
run: | | |
echo pushing ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
if [ ${{ env.AUTO_BUILD_LATEST }} = true ] ; then | |
docker tag ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:latest | |
echo pushing ${{ env.IMAGE_REPO }}:latest | |
docker push ${{ env.IMAGE_REPO }}:latest | |
fi |