Skip to content

Build docker image

Build docker image #19

Workflow file for this run

name: Build docker image
on:
# push:
# branches:
# - main
workflow_dispatch:
inputs:
dispatch:
type: string
description: "The tag name for docker images"
required: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 720
steps:
- name: output tag name for image
id: tag_name
run: |
if [ ${{ github.event_name }} == 'push' ]; then
export tag_name=`echo ${{ github.ref }} | awk -F '/' '{print $3}'`
fi
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
export tag_name=${{ github.event.inputs.dispatch }}
fi
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Git checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref || 'main' }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
timeout-minutes: 720
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: axonweb3/axon:${{ steps.tag_name.outputs.tag_name }}