Skip to content

Docker build and push #4

Docker build and push

Docker build and push #4

Workflow file for this run

on:
workflow_dispatch:
inputs:
version:
description: "Backend version"
default: "6.1.0"
required: true
name: Docker build and push
env:
IMAGE_REGISTRY: ${{ secrets.PROD_OVH_REGISTRY_URL }}
IMAGE_REPOSITORY: blockscout/backend
jobs:
check:
name: Check branch
runs-on: ubuntu-latest
steps:
- name: Exit if wrong branch
if: github.ref != 'refs/heads/production-harmony'
run: exit 1
indexer:
needs: check
name: Docker build and push - indexer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to OVH Managed Private Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.PROD_OVH_REGISTRY_USERNAME }}
password: ${{ secrets.PROD_OVH_REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
- name: Prepare image tag
shell: bash
run: |
echo "IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and push - indexer
run: |
docker build -t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-indexer:${{ env.IMAGE_TAG }} \
-t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-indexer:latest \
--build-arg BLOCKSCOUT_VERSION=v${{ github.event.inputs.version }} \
--build-arg RELEASE_VERSION=${{ github.event.inputs.version }} \
--build-arg DISABLE_WEBAPP=true \
--build-arg ADMIN_PANEL_ENABLED=false \
--build-arg CACHE_EXCHANGE_RATES_PERIOD= \
--build-arg API_V1_READ_METHODS_DISABLED=true \
--build-arg API_V1_WRITE_METHODS_DISABLED=true \
--build-arg CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=true \
--build-arg DECODE_NOT_A_CONTRACT_CALLS=false \
--build-arg MIXPANEL_URL= \
--build-arg MIXPANEL_TOKEN= \
--build-arg AMPLITUDE_URL= \
--build-arg AMPLITUDE_API_KEY= \
--build-arg CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= \
--cache-from blockscout/blockscout:buildcache \
-f ./docker/Dockerfile .
docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-indexer --all-tags
api:
needs: check
name: Docker build and push - api
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to OVH Managed Private Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.PROD_OVH_REGISTRY_USERNAME }}
password: ${{ secrets.PROD_OVH_REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
- name: Prepare image tag
shell: bash
run: |
echo "IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and push - api
run: |
docker build -t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-api:${{ env.IMAGE_TAG }} \
-t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-api:latest \
--build-arg BLOCKSCOUT_VERSION=v${{ github.event.inputs.version }} \
--build-arg RELEASE_VERSION=${{ github.event.inputs.version }} \
--build-arg DISABLE_WEBAPP=true \
--build-arg ADMIN_PANEL_ENABLED=false \
--build-arg CACHE_EXCHANGE_RATES_PERIOD= \
--build-arg API_V1_READ_METHODS_DISABLED=false \
--build-arg API_V1_WRITE_METHODS_DISABLED=false \
--build-arg CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=true \
--build-arg DECODE_NOT_A_CONTRACT_CALLS=false \
--build-arg MIXPANEL_URL= \
--build-arg MIXPANEL_TOKEN= \
--build-arg AMPLITUDE_URL= \
--build-arg AMPLITUDE_API_KEY= \
--build-arg CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= \
--cache-from blockscout/blockscout:buildcache \
-f ./docker/Dockerfile .
docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}-api --all-tags