Skip to content

feat: update build-image.yml #99

feat: update build-image.yml

feat: update build-image.yml #99

Workflow file for this run

name: Build and Push Docker Images
on:
workflow_dispatch:
inputs:
name:
description: "Manual workflow name"
required: true
push:
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
IMAGE_NAME: getconvoy/convoy
jobs:
build_ui:
name: Build UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Artifact
run: "make ui_install type=ce"
- name: Archive Build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-without-markdown
path: |
web/ui/dashboard/dist
!web/ui/dashboard/dist/**/*.md
build-and-push:
runs-on: ubuntu-latest
needs: [build_ui]
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
dockerfile: release.Dockerfile
- arch: arm64
platform: linux/arm64
dockerfile: release.Dockerfile
- arch: slim
platform: linux/amd64
dockerfile: slim.Dockerfile
steps:
- uses: actions/checkout@v4
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: dist-without-markdown
path: api/ui/build
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v4
- name: Get and verify dependencies
run: go mod tidy && go mod download && go mod verify
- name: Go vet
run: go vet ./...
- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ steps.slug.outputs.sha8 }}-${{ matrix.arch }}
${{ env.IMAGE_NAME }}:latest-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}