pinpoint-docker-fork/.github/workflows/docker-image.yml

74 lines
2.0 KiB
YAML
Raw Normal View History

name: Build And Push Docker Image
on:
workflow_call:
inputs:
component:
required: true
type: string
2023-04-17 06:59:33 +00:00
dockerfile:
required: false
type: string
default: 'Dockerfile'
tag_postfix:
required: false
type: string
default: ''
secrets:
docker_username:
required: true
docker_token:
required: true
docker_password:
required: true
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_token }}
2022-08-04 09:57:53 +00:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
2022-08-04 09:57:53 +00:00
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: pinpointdocker/${{ inputs.component }}
2023-04-17 07:20:57 +00:00
flavor: |
latest=auto
prefix=
suffix=${{ inputs.tag_postfix }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./${{ inputs.component }}
2023-04-17 06:59:33 +00:00
file: ./${{ inputs.component }}/${{ inputs.dockerfile }}
2022-07-29 08:52:45 +00:00
platforms: linux/amd64,linux/arm64
push: true
2023-04-17 07:20:57 +00:00
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update repo description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
repository: pinpointdocker/${{ inputs.component }}
readme-filepath: ./${{ inputs.component }}/Readme.md