Update docker-image.yml #69
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 CI | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_PLATFORMS: linux/amd64,linux/armhf,linux/arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: setup docker buildx | |
uses: docker/setup-buildx-action@v3 | |
id: buildx | |
with: | |
install: true | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAT_TOKEN }} | |
- name: Build and push amd64 action | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
sbom: true | |
provenance: true | |
outputs: type=registry | |
platforms: | | |
linux/amd64 | |
file: Dockerfile | |
cache-from: | | |
type=gha . | |
type=inline . | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
cache-to: | | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
tags: ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest, ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest | |
github-token: ${{ secrets.PAT_TOKEN }} | |
- name: Build and push armhf action | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
sbom: true | |
provenance: true | |
outputs: type=registry | |
platforms: | | |
linux/armhf | |
file: Dockerfile | |
cache-from: | | |
type=gha . | |
type=inline . | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
cache-to: | | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
tags: ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest, ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest | |
github-token: ${{ secrets.PAT_TOKEN }} | |
- name: Build and push arm64 action | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
sbom: true | |
provenance: true | |
outputs: type=registry | |
platforms: | | |
linux/arm64 | |
file: Dockerfile | |
cache-from: | | |
type=gha . | |
type=inline . | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
cache-to: | | |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
tags: ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest, ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
github-token: ${{ secrets.PAT_TOKEN }} | |
- name: Build and publish the multiplatform Docker Image | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker buildx build \ | |
--file Dockerfile \ | |
--sbom true\ | |
--provenance false \ | |
--platform linux/amd64,linux/armhf,linux/arm64 \ | |
-t ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control \ | |
--cache-from type=gha \ | |
--cache-from type=inline \ | |
--cache-from type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
--cache-to type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
--progress=plain --push . | |
docker manifest create ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest \ | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest \ | |
${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest | |
docker manifest annotate ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:amd64-latest --arch amd64 | |
docker manifest annotate ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:armhf-latest --arch arm | |
docker manifest annotate ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:arm64-latest --arch arm64 | |
docker manifest push ${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest | |
- name: Build and publish the multiplatform Docker Image | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker buildx build \ | |
--file Dockerfile \ | |
--sbom true \ | |
--provenance false \ | |
--platform linux/amd64,linux/armhf,linux/arm64 \ | |
-t ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
--cache-from type=gha \ | |
--cache-from type=inline \ | |
--cache-from type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
--cache-to type=registry,ref=ghcr.io/${{ secrets.DOCKER_USERNAME }}/docker-pharos-control:latest \ | |
--progress=plain --push . | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: peterevans/dockerhub-description | |
enable-url-completion: true |