Skip to content

Commit

Permalink
push to github docker registry too
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Oct 27, 2024
1 parent e7c5558 commit b0d24eb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
64 changes: 42 additions & 22 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,51 @@
name: C/C++ CI docker
name: Build docker

on: [push]

jobs:
build:
strategy:
matrix:
include:
- image: ubuntu:24.04
label: arm64
platform: linux/arm64
- image: balenalib/raspberry-pi
label: armv6l
platform: linux/arm/v6
- image: balenalib/raspberry-pi2
label: armv7
platform: linux/arm/v7
- image: ubuntu:24.04
label: amd64
platform: linux/amd64

runs-on: ubuntu-latest

permissions:
id-token: write
packages: write
contents: read
attestations: write

steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: setup
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
id: push
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6

- name: Build an image from Dockerfile
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker build -t docker.io/${{ github.repository }}:${{ matrix.label }} --platform ${{ matrix.platform }} --build-arg IMAGE=${{ matrix.image }} .
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG IMAGE=ubuntu:24.04
ARG IMAGE=debian:trixie
FROM $IMAGE AS builder
LABEL maintainer [email protected]

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
WORKDIR /v4l2rtspserver
Expand Down

0 comments on commit b0d24eb

Please sign in to comment.