Skip to content

Build and publish docker image #70

Build and publish docker image

Build and publish docker image #70

Workflow file for this run

name: Build and publish docker image
on:
workflow_run:
workflows: ["Release"]
types:
- completed
jobs:
buildx_and_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Get the version
id: get_version
run: |
version=$(git describe --tags --abbrev=0)
echo $version
echo ${version:1}
echo ::set-output name=VERSION::$version
echo ::set-output name=VERSION-NO-V::${version:1}
shell: bash
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and publish docker image
if: ${{ !contains(steps.get_version.outputs.VERSION, '-') }}
uses: docker/build-push-action@v2
with:
context: docker/release
file: ./docker/release/Dockerfile.release
build-args: RELEASE=${{ steps.get_version.outputs.VERSION-NO-V }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
docker.io/alephium/explorer-backend:${{ steps.get_version.outputs.VERSION }}
docker.io/alephium/explorer-backend:latest
push: true
- name: Build and publish docker image
uses: docker/build-push-action@v2
with:
context: docker/release
file: ./docker/release/Dockerfile.release
build-args: RELEASE=${{ steps.get_version.outputs.VERSION-NO-V }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
docker.io/alephium/dev-explorer-backend:${{ steps.get_version.outputs.VERSION-NO-V }}
docker.io/alephium/dev-explorer-backend:latest
push: true