| 1 |
name: 'Build docker on-demand' |
| 2 |
on: |
| 3 |
workflow_dispatch: |
| 4 |
inputs: |
| 5 |
tag: |
| 6 |
description: 'docker container tag' |
| 7 |
required: true |
| 8 |
type: string |
| 9 |
default: 'dev' |
| 10 |
|
| 11 |
permissions: |
| 12 |
contents: read |
| 13 |
packages: write |
| 14 |
|
| 15 |
jobs: |
| 16 |
docker: |
| 17 |
name: Docker Image Build |
| 18 |
runs-on: ubuntu-latest |
| 19 |
strategy: |
| 20 |
matrix: |
| 21 |
platform: |
| 22 |
- linux/amd64 |
| 23 |
- linux/arm64 |
| 24 |
- linux/arm/v7 |
| 25 |
- linux/arm/v8 |
| 26 |
steps: |
| 27 |
- name: Checkout |
| 28 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 29 |
with: |
| 30 |
persist-credentials: false |
| 31 |
|
| 32 |
- name: Docker meta for TAG |
| 33 |
id: meta |
| 34 |
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 |
| 35 |
with: |
| 36 |
images: ghcr.io/${{ github.repository }} |
| 37 |
tags: | |
| 38 |
type=raw,value=${{ inputs.tag }} |
| 39 |
|
| 40 |
- name: Login to GitHub Container Registry |
| 41 |
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee |
| 42 |
with: |
| 43 |
registry: ghcr.io |
| 44 |
username: ${{ github.actor }} |
| 45 |
password: ${{ secrets.GITHUB_TOKEN }} |
| 46 |
|
| 47 |
- name: Build and push |
| 48 |
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf |
| 49 |
with: |
| 50 |
context: . |
| 51 |
file: Dockerfile |
| 52 |
push: true |
| 53 |
platforms: linux/amd64 |
| 54 |
tags: ${{ steps.meta.outputs.tags }} |
| 55 |
labels: ${{ steps.meta.outputs.labels }} |