Skip to content

Docker build

Docker build #131

Workflow file for this run

name: Docker build
on:
workflow_run:
workflows: ["Semantic release"]
types:
- completed
branches:
- 'master'
jobs:
multi:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
- name: git tag
run: git fetch --tags; git fetch --prune --unshallow || true
- name: Extract tag name
id: dockerTag
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const tagExec = await exec.getExecOutput('git', ['describe', '--tags', '--abbrev=0']);
let tag = tagExec.stdout || tagExec.stderr;
tag = tag.trim().replace('v', '');
return tag;
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GHR_TOKEN }}
registry: ghcr.io
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/aldor007/mort:latest, ghcr.io/aldor007/mort:${{ steps.dockerTag.outputs.result}}
cache-from: type=registry,ref=ghcr.io/aldor007/mort-base:latest
cache-to: type=inline
build-args: |
COMMIT=${{ github.sha }}
DATE=${{ steps.date.outputs.date }}
TAG=${{ steps.dockerTag.outputs.result }}