Merge pull request #78 from joel-ling/main #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build and push Docker image tagged main | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read # principle of least privilege | |
jobs: | |
build: | |
name: Build and push Docker image tagged main | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx for multi-platform builds | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: ${{ vars.PLATFORMS }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: ${{ vars.PLATFORMS }} | |
push: true | |
sbom: true | |
tags: >- | |
${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ vars.IMAGE_NAME }}:main |