Docker image build and push #894
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: Docker image build and push | |
on: | |
push: | |
branches: | |
- 'master' | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
contents: read | |
jobs: | |
docker: | |
permissions: | |
deployments: write # Docker needs to be able to deploy and package. | |
packages: write | |
if: github.repository == 'brainboxdotcc/DPP' | |
runs-on: ubuntu-latest | |
concurrency: | |
group: docker-deployment | |
cancel-in-progress: false | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 | |
with: | |
push: true | |
tags: brainboxdotcc/dpp | |
- # copy multiplatform image from dockerhub to ghcr | |
name: Push Image to multiple registries | |
uses: akhilerm/tag-push-action@85bf542f43f5f2060ef76262a67ee3607cb6db37 # v2.1.0 | |
with: | |
src: docker.io/brainboxdotcc/dpp:latest | |
dst: | | |
ghcr.io/brainboxdotcc/dpp:latest |