Skip to content

Build and push docker images #30

Build and push docker images

Build and push docker images #30

Workflow file for this run

name: Build and push docker images
on:
workflow_run:
workflows: ["Packed and release Yao Application"]
types:
- completed
workflow_dispatch:
inputs:
tags:
description: "Comment"
push:
branches: [main]
paths:
- "app.sample.yao"
env:
IMAGE_ORG: wwsheng009
IMAGE_NAME: ${{ github.event.repository.name }}
REPO_DOCKERFILES: ${{ github.repository_owner }}/dockerfiles
VERSION: 1.0.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Application Source
uses: actions/checkout@v2
- name: Get Version
run: |
VERSION=$(cat app.sample.yao |grep version |awk -F : '{print $2}' | sed 's/"//g' | sed 's/,//g' | sed 's/ //g')
if [ -z "$VERSION" ]; then
VERSION=1.0.0
fi
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Check Version
run: echo $VERSION
- 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_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build & Push Docker Image for amd64
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/amd64
build-args: |
VERSION=${{ env.VERSION }}
ARCH=amd64
push: true
tags: ${{ env.IMAGE_ORG }}/${{ env.IMAGE_NAME }}-amd64:latest
- name: Build & Push Docker Image for arm64
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/arm64
build-args: |
VERSION=${{ env.VERSION }}
ARCH=arm64
push: true
tags: ${{ env.IMAGE_ORG }}/${{ env.IMAGE_NAME }}-arm64:latest