name: Build And Push Docker Image on: workflow_call: inputs: component: required: true type: string 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 }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx 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 }} - name: Build and push Docker image uses: docker/build-push-action@v2 with: context: ./${{ inputs.component }} file: ./${{ inputs.component }}/${{ inputs.dockerfile }} platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }}${{ inputs.tag_postfix }} 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