Docker Image #1210
This file contains hidden or 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: Docker Image | |
| on: | |
| schedule: | |
| - cron: "0 10 * * *" # everyday at 10am | |
| workflow_dispatch: | |
| pull_request: | |
| branches: ["**"] | |
| push: | |
| branches: ["**"] | |
| tags: ["v*.*.*"] | |
| env: | |
| platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 | |
| jobs: | |
| main: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.head_ref || github.ref }} | |
| - name: Set imageName based on the repository name | |
| id: step_one | |
| run: | | |
| imageName="${GITHUB_REPOSITORY/docker-/}" | |
| echo $imageName | |
| echo "imageName=$imageName" >> $GITHUB_ENV | |
| - name: Docker meta | |
| id: docker_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.imageName }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: ${{ env.platforms }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| pull: true | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| - name: Docker Scout | |
| id: docker-scout-cves | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: docker/scout-action@v1 | |
| with: | |
| command: cves | |
| image: ${{ env.imageName }}:${{ steps.docker_meta.outputs.version }} | |
| only-severities: critical,high | |
| exit-code: true |