From 49af9c2a40ba582cf1c067984fbf3ee9992ff535 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Fri, 27 Oct 2023 10:51:32 -0600 Subject: [PATCH] feat: add arm docker build --- .github/workflows/push-dockers.yml | 128 ----------------------------- .github/workflows/release.yml | 11 ++- .github/workflows/test-arm.yml | 49 ----------- 3 files changed, 10 insertions(+), 178 deletions(-) delete mode 100644 .github/workflows/push-dockers.yml delete mode 100644 .github/workflows/test-arm.yml diff --git a/.github/workflows/push-dockers.yml b/.github/workflows/push-dockers.yml deleted file mode 100644 index 2eba6438..00000000 --- a/.github/workflows/push-dockers.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: Build Publish Docker Images - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc - -env: - DOCKER_REPOSITORY: osmolabs/osmosis - RUNNER_BASE_IMAGE_DISTROLESS: gcr.io/distroless/static-debian11 - RUNNER_BASE_IMAGE_NONROOT: gcr.io/distroless/static-debian11:nonroot - RUNNER_BASE_IMAGE_ALPINE: alpine:3.17 - -jobs: - osmosisd-images: - runs-on: self-hosted - steps: - - - name: Check out the repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Find go version - id: find_go_version - run: | - GO_VERSION=$(cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2) - echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV - - - name: Parse tag - id: tag - run: | - VERSION=$(echo ${{ github.ref_name }} | sed "s/v//") - MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1) - MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2) - PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3) - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV - echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV - echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV - # Distroless Docker image (default) - - - name: Build and push (distroless) - id: build_push_distroless - uses: docker/build-push-action@v5 - with: - file: Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - build-args: | - GO_VERSION=${{ env.GO_VERSION }} - RUNNER_IMAGE=${{ env.RUNNER_BASE_IMAGE_DISTROLESS }} - GIT_VERSION=${{ env.VERSION }} - GIT_COMMIT=${{ github.sha }} - tags: | - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }} - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}-distroless - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-distroless - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-distroless - # Distroless nonroot Docker image - - - name: Build and push (nonroot) - id: build_push_nonroot - uses: docker/build-push-action@v5 - with: - file: Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - build-args: | - GO_VERSION=${{ env.GO_VERSION }} - RUNNER_IMAGE=${{ env.RUNNER_BASE_IMAGE_NONROOT }} - GIT_VERSION=${{ env.VERSION }} - GIT_COMMIT=${{ github.sha }} - tags: | - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}-nonroot - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-nonroot - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-nonroot - # Alpine Docker image - - - name: Build and push (alpine) - id: build_push_alpine - uses: docker/build-push-action@v5 - with: - file: Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - build-args: | - GO_VERSION=${{ env.GO_VERSION }} - RUNNER_IMAGE=${{ env.RUNNER_BASE_IMAGE_ALPINE }} - GIT_VERSION=${{ env.VERSION }} - GIT_COMMIT=${{ github.sha }} - tags: | - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}-alpine - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-alpine - ${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-alpine - - - if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0') - name: Build and push (e2e-chain-init) - uses: docker/build-push-action@v5 - with: - file: tests/e2e/initialization/init.Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - build-args: | - E2E_SCRIPT_NAME=chain - tags: | - osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }} - osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} - osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 529cbbc2..bb671a4d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,6 +49,12 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -66,7 +72,10 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: ./dockers/seda-node.Dockerfile + file: ./dockers/seda-node-static.Dockerfile + platforms: linux/amd64,linux/arm64 + GO_VERSION: "1.21" + RUNNER_IMAGE: "gcr.io/distroless/static-debian11:nonroot" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test-arm.yml b/.github/workflows/test-arm.yml deleted file mode 100644 index ca460e68..00000000 --- a/.github/workflows/test-arm.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Test-arm - -on: - push: - branches: - - "JeancarloBarrios/arm-docker-build" - pull_request: - branches: - - "JeancarloBarrios/arm-docker-build" - -jobs: - build_push_node_image-test: - name: Build and Push Docker Image to GHCR - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/sedaprotocol/node - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./dockers/seda-node-static.Dockerfile - platforms: linux/amd64,linux/arm64 - GO_VERSION: "1.21" - RUNNER_IMAGE: "gcr.io/distroless/static-debian11:nonroot" - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} -