From 18f48d69250bd3d0cd30ab8451bd335cef4f1d8e Mon Sep 17 00:00:00 2001 From: Rim Rakhimov Date: Wed, 26 Jun 2024 15:59:00 +0200 Subject: [PATCH] [workflow] Update services to reuse docker workflow (#946) * da-indexer * eth-bytecode-db * proxy-verifier * scoutcloud * sig-provider * smart-contract-verifier * smart-guessr * stats * user-ops-indexer --- .github/workflows/da-indexer.yml | 55 ++---------------- .github/workflows/eth-bytecode-db.yml | 55 ++---------------- .github/workflows/proxy-verifier.yml | 55 ++---------------- .github/workflows/scoutcloud.yml | 57 +++---------------- .github/workflows/sig-provider.yml | 55 ++---------------- .github/workflows/smart-contract-verifier.yml | 55 ++---------------- .github/workflows/smart-guessr.yml | 56 +++--------------- .github/workflows/stats.yml | 55 ++---------------- .github/workflows/user-ops-indexer.yml | 55 ++---------------- .../{eth-bytecode-db-server => }/Dockerfile | 0 .../docker-compose.yml | 8 +-- .../Dockerfile | 0 .../docker-compose.yml | 8 +-- 13 files changed, 64 insertions(+), 450 deletions(-) rename eth-bytecode-db/{eth-bytecode-db-server => }/Dockerfile (100%) rename eth-bytecode-db/{eth-bytecode-db-server => }/docker-compose.yml (90%) rename smart-contract-verifier/{smart-contract-verifier-server => }/Dockerfile (100%) rename smart-contract-verifier/{smart-contract-verifier-server => }/docker-compose.yml (79%) diff --git a/.github/workflows/da-indexer.yml b/.github/workflows/da-indexer.yml index 07035c675..c8afe0a7d 100644 --- a/.github/workflows/da-indexer.yml +++ b/.github/workflows/da-indexer.yml @@ -8,18 +8,16 @@ on: - da-indexer/** - .github/workflows/da-indexer.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - da-indexer/** - .github/workflows/da-indexer.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (da-indexer) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/da-indexer - defaults: run: working-directory: da-indexer @@ -107,7 +105,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -116,47 +114,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/da-indexer\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: "da-indexer" - file: "da-indexer/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} - \ No newline at end of file + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: da-indexer diff --git a/.github/workflows/eth-bytecode-db.yml b/.github/workflows/eth-bytecode-db.yml index 5001a9234..305270785 100644 --- a/.github/workflows/eth-bytecode-db.yml +++ b/.github/workflows/eth-bytecode-db.yml @@ -8,18 +8,16 @@ on: - eth-bytecode-db/** - .github/workflows/eth-bytecode-db.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - eth-bytecode-db/** - .github/workflows/eth-bytecode-db.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (eth-bytecode-db) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/eth-bytecode-db - defaults: run: working-directory: eth-bytecode-db @@ -119,7 +117,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -128,47 +126,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/eth-bytecode-db\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "eth-bytecode-db" - file: "eth-bytecode-db/eth-bytecode-db-server/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: eth-bytecode-db diff --git a/.github/workflows/proxy-verifier.yml b/.github/workflows/proxy-verifier.yml index b8ad0117d..3361fb072 100644 --- a/.github/workflows/proxy-verifier.yml +++ b/.github/workflows/proxy-verifier.yml @@ -8,18 +8,16 @@ on: - proxy-verifier/** - .github/workflows/proxy-verifier.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - proxy-verifier/** - .github/workflows/proxy-verifier.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (proxy-verifier) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/proxy-verifier - defaults: run: working-directory: proxy-verifier @@ -89,7 +87,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -98,47 +96,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/proxy-verifier\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "proxy-verifier" - file: "proxy-verifier/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} - + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: proxy-verifier diff --git a/.github/workflows/scoutcloud.yml b/.github/workflows/scoutcloud.yml index 2c454e055..0fd930961 100644 --- a/.github/workflows/scoutcloud.yml +++ b/.github/workflows/scoutcloud.yml @@ -8,18 +8,16 @@ on: - scoutcloud/** - .github/workflows/scoutcloud.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - scoutcloud/** - .github/workflows/scoutcloud.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (scoutcloud) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/scoutcloud - defaults: run: working-directory: scoutcloud @@ -111,7 +109,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -120,54 +118,13 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: scoutcloud - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/scoutcloud\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "scoutcloud" - file: "scoutcloud/Dockerfile" - build-contexts: | - proto=proto - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} deploy_prod: name: Deploy prod instance - needs: push + needs: docker if: ${{ github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest permissions: write-all diff --git a/.github/workflows/sig-provider.yml b/.github/workflows/sig-provider.yml index 8ea871910..20b87e679 100644 --- a/.github/workflows/sig-provider.yml +++ b/.github/workflows/sig-provider.yml @@ -8,18 +8,16 @@ on: - sig-provider/** - .github/workflows/sig-provider.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - sig-provider/** - .github/workflows/sig-provider.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (sig-provider) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/sig-provider - defaults: run: working-directory: sig-provider @@ -89,7 +87,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -98,47 +96,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/sig-provider\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "sig-provider" - file: "sig-provider/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: sig-provider diff --git a/.github/workflows/smart-contract-verifier.yml b/.github/workflows/smart-contract-verifier.yml index 6b523555b..dfdb921a0 100644 --- a/.github/workflows/smart-contract-verifier.yml +++ b/.github/workflows/smart-contract-verifier.yml @@ -8,18 +8,16 @@ on: - smart-contract-verifier/** - .github/workflows/smart-contract-verifier.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - smart-contract-verifier/** - .github/workflows/smart-contract-verifier.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (smart-contract-verifier) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/smart-contract-verifier - defaults: run: working-directory: smart-contract-verifier @@ -89,7 +87,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -98,47 +96,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/smart-contract-verifier\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "smart-contract-verifier" - file: "smart-contract-verifier/smart-contract-verifier-server/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: smart-contract-verifier diff --git a/.github/workflows/smart-guessr.yml b/.github/workflows/smart-guessr.yml index f0d560167..52bfbbe06 100644 --- a/.github/workflows/smart-guessr.yml +++ b/.github/workflows/smart-guessr.yml @@ -7,17 +7,15 @@ on: paths: - smart-guessr/** - .github/workflows/smart-guessr.yml + - .github/workflows/docker-build-push.yml pull_request: paths: - smart-guessr/** - .github/workflows/smart-guessr.yml + - .github/workflows/docker-build-push.yml name: Test and docker (smart-guessr) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/smart-guessr - defaults: run: working-directory: smart-guessr @@ -37,56 +35,16 @@ jobs: run: bun install - name: Run tests - run: bun test + run: bun test --timeout 15000 if: success() || failure() - push: + docker: name: Docker build and docker push needs: - test if: | always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/smart-guessr\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "smart-guessr" - file: "smart-guessr/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: smart-guessr diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 55754da2b..dd445e668 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -8,18 +8,16 @@ on: - stats/** - .github/workflows/stats.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - stats/** - .github/workflows/stats.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (stats) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/stats - defaults: run: working-directory: stats @@ -108,7 +106,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -117,47 +115,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/stats\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "stats" - file: "stats/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: stats diff --git a/.github/workflows/user-ops-indexer.yml b/.github/workflows/user-ops-indexer.yml index c6d1e77f4..db70c0e29 100644 --- a/.github/workflows/user-ops-indexer.yml +++ b/.github/workflows/user-ops-indexer.yml @@ -8,18 +8,16 @@ on: - user-ops-indexer/** - .github/workflows/user-ops-indexer.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml pull_request: paths: - user-ops-indexer/** - .github/workflows/user-ops-indexer.yml - .github/actions/deps/** + - .github/workflows/docker-build-push.yml name: Test, lint and docker (user-ops-indexer) -env: - REGISTRY: ghcr.io - IMAGE_NAME: blockscout/user-ops-indexer - defaults: run: working-directory: user-ops-indexer @@ -105,7 +103,7 @@ jobs: - name: cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - push: + docker: name: Docker build and docker push needs: - test @@ -114,47 +112,6 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions-ecosystem/action-regex-match@v2 - id: regex - with: - text: ${{ github.ref }} - regex: '^(refs\/tags\/user-ops-indexer\/(v\d+\.\d+\.\d+))|(refs\/heads\/(main))$' - - - name: Extract tag name - id: tags_extractor - run: | - t=${{ steps.regex.outputs.group2 }} - m=${{ steps.regex.outputs.group4 }} - (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "user-ops-indexer" - file: "user-ops-indexer/Dockerfile" - push: ${{ steps.tags_extractor.outputs.tags != '' }} - tags: ${{ steps.tags_extractor.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache - cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} + uses: ./.github/workflows/docker-build-push.yml + with: + service-name: user-ops-indexer diff --git a/eth-bytecode-db/eth-bytecode-db-server/Dockerfile b/eth-bytecode-db/Dockerfile similarity index 100% rename from eth-bytecode-db/eth-bytecode-db-server/Dockerfile rename to eth-bytecode-db/Dockerfile diff --git a/eth-bytecode-db/eth-bytecode-db-server/docker-compose.yml b/eth-bytecode-db/docker-compose.yml similarity index 90% rename from eth-bytecode-db/eth-bytecode-db-server/docker-compose.yml rename to eth-bytecode-db/docker-compose.yml index 1590ea870..283c3c5af 100644 --- a/eth-bytecode-db/eth-bytecode-db-server/docker-compose.yml +++ b/eth-bytecode-db/docker-compose.yml @@ -20,8 +20,8 @@ services: ## you can build an image locally, or use pre-built images from registry # image: ghcr.io/blockscout/eth-bytecode-db:main build: - context: .. - dockerfile: ./eth-bytecode-db-server/Dockerfile + context: . + dockerfile: ./Dockerfile container_name: 'eth-bytecode-db' restart: always depends_on: @@ -39,7 +39,7 @@ services: ETH_BYTECODE_DB__DATABASE__RUN_MIGRATIONS: true env_file: ## optional: if provided, would overwrite values from configuration file - - ./config/base.env + - ./eth-bytecode-db-server/config/base.env volumes: ## optional: you can use default config or provide custom via file - - ./config/base.toml:/app/config.toml + - ./eth-bytecode-db-server/config/base.toml:/app/config.toml diff --git a/smart-contract-verifier/smart-contract-verifier-server/Dockerfile b/smart-contract-verifier/Dockerfile similarity index 100% rename from smart-contract-verifier/smart-contract-verifier-server/Dockerfile rename to smart-contract-verifier/Dockerfile diff --git a/smart-contract-verifier/smart-contract-verifier-server/docker-compose.yml b/smart-contract-verifier/docker-compose.yml similarity index 79% rename from smart-contract-verifier/smart-contract-verifier-server/docker-compose.yml rename to smart-contract-verifier/docker-compose.yml index 1fe65d987..d07841f8a 100644 --- a/smart-contract-verifier/smart-contract-verifier-server/docker-compose.yml +++ b/smart-contract-verifier/docker-compose.yml @@ -4,8 +4,8 @@ services: ## you can build an image locally, or use pre-built images from registry # image: ghcr.io/blockscout/smart-contract-verifier:main build: - context: .. - dockerfile: smart-contract-verifier-server/Dockerfile + context: . + dockerfile: ./Dockerfile ports: - "8050:8050" - "8051:8051" @@ -14,9 +14,9 @@ services: - SMART_CONTRACT_VERIFIER__CONFIG=/app/config.toml env_file: ## optional: if provided, would overwrite values from configuration file - - ./config/base.env + - ./smart-contract-verifier-server/config/base.env volumes: ## optional: you can use default config or provide custom via file - - ./config/base.toml:/app/config.toml + - ./smart-contract-verifier-server/config/base.toml:/app/config.toml ## optional: provide volume or folder to store compilers between launches - /tmp/compilers:/tmp/compilers