From 7867709e94c24d338e357b690c4a16daefa01447 Mon Sep 17 00:00:00 2001 From: DaMandal0rian Date: Thu, 28 Sep 2023 18:17:18 +0300 Subject: [PATCH 1/2] add docker build for backend image --- .github/workflows/deploy-subspace.yml | 76 +++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/deploy-subspace.yml diff --git a/.github/workflows/deploy-subspace.yml b/.github/workflows/deploy-subspace.yml new file mode 100644 index 000000000000..04ef278862a8 --- /dev/null +++ b/.github/workflows/deploy-subspace.yml @@ -0,0 +1,76 @@ +name: Deploy from subspace-backend branch + +on: + push: + branches: + - "!main" + pull_request: + branches: + - subspace-backend + +env: + TAG_NAME: subspace + OTP_VERSION: "25.2.1" + ELIXIR_VERSION: "1.14.3" + +# concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true + +jobs: + publish_image: + name: Publish Docker image + env: + RELEASE_VERSION: 5.2.3 + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Will automatically make nice tags, see the table here https://github.com/docker/metadata-action#basic + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/subspace/blockscout-backend + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Add SHORT_SHA env property with commit short sha + run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + push: true + cache-from: type=registry,ref=blockscout/blockscout:buildcache + cache-to: type=registry,ref=blockscout/blockscout:buildcache,mode=max + tags: ghcr.io/${{ github.repository_owner }}/blockscout-backend:${{ env.TAG_NAME }} + platforms: | + linux/arm64 + linux/amd64 + build-args: | + CACHE_EXCHANGE_RATES_PERIOD= + API_V1_READ_METHODS_DISABLED=false + DISABLE_WEBAPP=false + API_V1_WRITE_METHODS_DISABLED=false + CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED= + ADMIN_PANEL_ENABLED=false + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta + RELEASE_VERSION=${{ env.RELEASE_VERSION }} From 5a14dd484c8ac409150e24616fbe27d0725b92e6 Mon Sep 17 00:00:00 2001 From: DaMandal0rian Date: Thu, 28 Sep 2023 19:06:20 +0300 Subject: [PATCH 2/2] add qemu emulator + fix cache registry --- .github/workflows/deploy-subspace.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-subspace.yml b/.github/workflows/deploy-subspace.yml index 04ef278862a8..84c330703538 100644 --- a/.github/workflows/deploy-subspace.yml +++ b/.github/workflows/deploy-subspace.yml @@ -27,6 +27,9 @@ jobs: - name: Check out the repo uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -51,10 +54,10 @@ jobs: uses: docker/build-push-action@v3 with: context: . - file: ./Dockerfile + file: ./docker/Dockerfile push: true - cache-from: type=registry,ref=blockscout/blockscout:buildcache - cache-to: type=registry,ref=blockscout/blockscout:buildcache,mode=max + cache-from: type=gha + cache-to: type=gha,mode=max tags: ghcr.io/${{ github.repository_owner }}/blockscout-backend:${{ env.TAG_NAME }} platforms: | linux/arm64