Skip to content

Commit

Permalink
Push docker images to DockerHub (frain-dev#2122)
Browse files Browse the repository at this point in the history
* feat: update build-image.yml

* feat: multi arch build

* feat: update images and remove useless action files

* chore: test update
  • Loading branch information
jirevwe authored Aug 23, 2024
1 parent ed0b5bb commit 0a4b8fd
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 476 deletions.
158 changes: 137 additions & 21 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,152 @@
name: Build docker image
name: Build and Push Docker Images

on:
workflow_dispatch:
inputs:
name:
description: "Manual workflow name"
required: true

push:
tags:
# Release binary for every tag.
- v*

env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
IMAGE_NAME: getconvoy/convoy
RELEASE_VERSION: ${{ github.ref_name }}

jobs:
deploy:
runs-on: "ubuntu-latest"
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-arch:
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

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@v5
with:
go-version: 1.21

- 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: 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 arch specific images
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}
build-and-push-default:
runs-on: ubuntu-latest
needs: [build_ui]
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@v5
with:
go-version: 1.21

- 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: Checkout code
uses: actions/checkout@v2
- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd

- name: Get the version
id: get_version
run: echo ::set-output name=tag::$(cat VERSION)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Authenticate
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.PAT }}
DOCKER_REGISTRY_URL: ghcr.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build latest image
run: docker build -t ghcr.io/${GITHUB_REPOSITORY}:${{ steps.get_version.outputs.tag }} .
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}

- name: Push
uses: actions-hub/docker@master
with:
args: push ghcr.io/${GITHUB_REPOSITORY}:${{ steps.get_version.outputs.tag }}
- name: Build and push default image
uses: docker/build-push-action@v2
with:
context: .
file: release.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.IMAGE_NAME }}:latest
34 changes: 0 additions & 34 deletions .github/workflows/do-deploy.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
os: [ubuntu-latest, macos-latest]
postgres-version: ["15"]
redis-version: ["6.2.6"]
typesense-version: ["0.24.0"]

runs-on: ubuntu-latest
services:
Expand All @@ -36,12 +35,6 @@ jobs:
redis-version: ${{ matrix.redis-version }}
redis-port: 6379

- name: Start Typesense v${{ matrix.typesense-version }}
uses: jirevwe/typesense-github-action@v1.0.1
with:
typesense-version: ${{ matrix.typesense-version }}
typesense-api-key: some-api-key

- name: Get the version
id: get_version
run: echo ::set-output name=tag::$(echo ${GITHUB_SHA:8})
Expand Down Expand Up @@ -97,9 +90,6 @@ jobs:
TEST_REDIS_SCHEME: redis
TEST_REDIS_HOST: localhost
TEST_REDIS_PORT: 6379
TEST_TYPESENSE_HOST: http://localhost:8108
TEST_TYPESENSE_API_KEY: some-api-key
TEST_SEARCH_TYPE: typesense

- name: Run integration tests (with test containers)
run: make docker_e2e_tests
Expand All @@ -114,7 +104,4 @@ jobs:
TEST_REDIS_SCHEME: redis
TEST_REDIS_HOST: localhost
TEST_REDIS_PORT: 6379
TEST_TYPESENSE_HOST: http://localhost:8108
TEST_TYPESENSE_API_KEY: some-api-key
TEST_SEARCH_TYPE: typesense

83 changes: 0 additions & 83 deletions .github/workflows/immune-test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
Expand Down
Loading

0 comments on commit 0a4b8fd

Please sign in to comment.