2021-11-11 05:27:00 +00:00
|
|
|
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: ''
|
2021-11-11 05:27:00 +00:00
|
|
|
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
|
|
|
|
|
2021-11-11 05:27:00 +00:00
|
|
|
- name: Set up Docker Buildx
|
2022-08-04 09:57:53 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
2021-11-11 05:27:00 +00:00
|
|
|
- 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=
|
2023-04-17 07:25:26 +00:00
|
|
|
suffixLatest=true
|
2023-04-17 07:20:57 +00:00
|
|
|
suffix=${{ inputs.tag_postfix }}
|
2021-11-11 05:27:00 +00:00
|
|
|
|
|
|
|
- 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
|
2021-11-11 05:27:00 +00:00
|
|
|
push: true
|
2023-04-17 07:20:57 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2021-11-11 05:27:00 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|