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

57 lines
1.5 KiB
YAML
Raw Normal View History

name: Build And Push Docker Image
on:
workflow_call:
inputs:
component:
required: true
type: string
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 }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: pinpointdocker/${{ inputs.component }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./${{ inputs.component }}
platforms: linux/amd64
push: true
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