From a336752d50f84823881b44c87c6c0683972f8148 Mon Sep 17 00:00:00 2001 From: david-hummingbot <85695272+david-hummingbot@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:41:56 +0800 Subject: [PATCH 1/2] add docker workflow - added workflows to build both the latest and version tags for gateway --- .github/workflows/docker_build_latest | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/docker_build_latest diff --git a/.github/workflows/docker_build_latest b/.github/workflows/docker_build_latest new file mode 100644 index 0000000000..e6d0ffab65 --- /dev/null +++ b/.github/workflows/docker_build_latest @@ -0,0 +1,47 @@ +name: Build and Push Docker image + +on: + pull_request: + types: [closed] + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + steps: + - name: Checkout code + uses: actions/checkout@v3.5.3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.2.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.9.1 + with: + version: latest + + - name: Login to DockerHub + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v4.1.1 + with: + context: . + push: true + tags: hummingbot/gateway:latest + platforms: linux/amd64,linux/arm64 + build-args: | + BRANCH=${{ github.ref }} + COMMIT=${{ github.sha }} + BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') + cache-from: type=registry,ref=hummingbot/gateway:latest + cache-to: type=inline + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} From 00c1e3f750a8ced1e8c3f0c1df45b87cfc48ed84 Mon Sep 17 00:00:00 2001 From: david-hummingbot <85695272+david-hummingbot@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:44:33 +0800 Subject: [PATCH 2/2] add docker_build_tags --- .github/workflows/docker_build_tags | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/docker_build_tags diff --git a/.github/workflows/docker_build_tags b/.github/workflows/docker_build_tags new file mode 100644 index 0000000000..72a6224570 --- /dev/null +++ b/.github/workflows/docker_build_tags @@ -0,0 +1,37 @@ +name: Build and push Docker images on release + +on: + release: + types: [published, edited] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.2.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.7.0 + + - name: Login to DockerHub + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract tag name + id: get_tag + run: echo ::set-output name=VERSION::version-${GITHUB_REF#refs/tags/v} + + - name: Build and push + uses: docker/build-push-action@v4.1.1 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: hummingbot/gateway:${{ steps.get_tag.outputs.VERSION }}