diff --git a/.github/workflows/publish-gstreamer-amd64.yaml b/.github/workflows/publish-gstreamer-amd64.yaml index 2c500f7c..596db2c1 100644 --- a/.github/workflows/publish-gstreamer-amd64.yaml +++ b/.github/workflows/publish-gstreamer-amd64.yaml @@ -7,7 +7,8 @@ jobs: gstreamer-build-amd64: uses: ./.github/workflows/publish-gstreamer-base.yaml with: - buildjet-runs-on: buildjet-8vcpu-ubuntu-2204 + buildjet-runs-on: buildjet-8vcpu-ubuntu-2204 + arch: amd64 secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/publish-gstreamer-arm64.yaml b/.github/workflows/publish-gstreamer-arm64.yaml index c787247e..44c60900 100644 --- a/.github/workflows/publish-gstreamer-arm64.yaml +++ b/.github/workflows/publish-gstreamer-arm64.yaml @@ -8,6 +8,7 @@ jobs: uses: ./.github/workflows/publish-gstreamer-base.yaml with: buildjet-runs-on: namespace-profile-arm-16 + arch: arm64 secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/publish-gstreamer-base.yaml b/.github/workflows/publish-gstreamer-base.yaml index d01d5447..fa17491e 100644 --- a/.github/workflows/publish-gstreamer-base.yaml +++ b/.github/workflows/publish-gstreamer-base.yaml @@ -4,6 +4,9 @@ on: buildjet-runs-on: required: true type: string + arch: + required: true + type: string secrets: DOCKERHUB_USERNAME: required: true @@ -39,7 +42,7 @@ jobs: GSTREAMER_VERSION=${{ env.GST_VERSION }} LIBNICE_VERSION=${{ env.LIBNICE_VERSION }} file: ./build/gstreamer/Dockerfile-base - tags: livekit/gstreamer:base-${{ env.GST_VERSION }} + tags: livekit/gstreamer:${{ env.GST_VERSION }}-base-${{ inputs.arch }} - name: Build and push dev uses: docker/build-push-action@v5 @@ -50,7 +53,7 @@ jobs: GSTREAMER_VERSION=${{ env.GST_VERSION }} LIBNICE_VERSION=${{ env.LIBNICE_VERSION }} file: ./build/gstreamer/Dockerfile-dev - tags: livekit/gstreamer:dev-${{ env.GST_VERSION }} + tags: livekit/gstreamer:${{ env.GST_VERSION }}-dev-${{ inputs.arch }} - name: Build and push prod uses: docker/build-push-action@v5 @@ -61,10 +64,7 @@ jobs: GSTREAMER_VERSION=${{ env.GST_VERSION }} LIBNICE_VERSION=${{ env.LIBNICE_VERSION }} file: ./build/gstreamer/Dockerfile-prod - tags: livekit/gstreamer:prod-${{ env.GST_VERSION }} - - - name: Prune docker state - run: docker rmi livekit/gstreamer:base-${{ env.GST_VERSION }} + tags: livekit/gstreamer:${{ env.GST_VERSION }}-prod-${{ inputs.arch }} - name: Build and push prod RS uses: docker/build-push-action@v5 @@ -75,4 +75,4 @@ jobs: GSTREAMER_VERSION=${{ env.GST_VERSION }} LIBNICE_VERSION=${{ env.LIBNICE_VERSION }} file: ./build/gstreamer/Dockerfile-prod-rs - tags: livekit/gstreamer:prod-rs-${{ env.GST_VERSION }} + tags: livekit/gstreamer:${{ env.GST_VERSION }}-prod-rs-${{ inputs.arch }} diff --git a/.github/workflows/publish-gstreamer-tag.yaml b/.github/workflows/publish-gstreamer-tag.yaml new file mode 100644 index 00000000..6b8d355e --- /dev/null +++ b/.github/workflows/publish-gstreamer-tag.yaml @@ -0,0 +1,25 @@ +name: GStreamer publish tag + +on: + workflow_dispatch: + +jobs: + tag-gstreamer-build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Run tag script + run: ./build/gstreamer/tag.sh + + diff --git a/build/gstreamer/Dockerfile-dev b/build/gstreamer/Dockerfile-dev index 527ebeca..89636f35 100644 --- a/build/gstreamer/Dockerfile-dev +++ b/build/gstreamer/Dockerfile-dev @@ -1,6 +1,6 @@ ARG GSTREAMER_VERSION -FROM livekit/gstreamer:${GSTREAMER_VERSION}-base +FROM livekit/gstreamer:${GSTREAMER_VERSION}-base-${TARGETARCH} ENV DEBUG=true ENV OPTIMIZATIONS=false diff --git a/build/gstreamer/Dockerfile-prod b/build/gstreamer/Dockerfile-prod index a9cd4406..9b378fcf 100644 --- a/build/gstreamer/Dockerfile-prod +++ b/build/gstreamer/Dockerfile-prod @@ -1,6 +1,6 @@ ARG GSTREAMER_VERSION -FROM livekit/gstreamer:${GSTREAMER_VERSION}-base +FROM livekit/gstreamer:${GSTREAMER_VERSION}-base-${TARGETARCH} ENV DEBUG=false ENV OPTIMIZATIONS=true diff --git a/build/gstreamer/Dockerfile-prod-rs b/build/gstreamer/Dockerfile-prod-rs index 6e1fa387..04cec5d4 100644 --- a/build/gstreamer/Dockerfile-prod-rs +++ b/build/gstreamer/Dockerfile-prod-rs @@ -1,8 +1,8 @@ ARG GSTREAMER_VERSION -FROM livekit/gstreamer:${GSTREAMER_VERSION}-base +FROM livekit/gstreamer:${GSTREAMER_VERSION}-base-${TARGETARCH} -FROM livekit/gstreamer:${GSTREAMER_VERSION}-dev +FROM livekit/gstreamer:${GSTREAMER_VERSION}-dev-${TARGETARCH} COPY --from=0 /gst-plugins-rs /gst-plugins-rs @@ -14,6 +14,6 @@ COPY compile-rs / RUN /compile-rs -FROM livekit/gstreamer:${GSTREAMER_VERSION}-prod +FROM livekit/gstreamer:${GSTREAMER_VERSION}-prod-${TARGETARCH} COPY --from=1 /compiled-binaries / diff --git a/build/gstreamer/tag.sh b/build/gstreamer/tag.sh new file mode 100755 index 00000000..7a662432 --- /dev/null +++ b/build/gstreamer/tag.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +image_suffix=(base dev prod prod-rs) +archs=(amd64 arm64) +gst_version=1.22.8 + +for suffix in ${image_suffix[*]} +do + digests=() + for arch in ${archs[*]} + do + digest=`docker manifest inspect livekit/gstreamer:$gst_version-$suffix-$arch | jq ".manifests[] | select(.platform.architecture == \"$arch\").digest"` + # remove quotes + digest=${digest:1:$[${#digest}-2]} + digests+=($digest) + done + + manifests="" + for digest in ${digests[*]} + do + manifests+=" livekit/gstreamer@$digest" + done + + docker manifest create livekit/gstreamer:$gst_version-$suffix$manifests + docker manifest push livekit/gstreamer:$gst_version-$suffix +done + diff --git a/magefile.go b/magefile.go index f6ea539e..dd33a72a 100644 --- a/magefile.go +++ b/magefile.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "path" + "runtime" "strings" "github.com/livekit/mageutil" @@ -165,9 +166,10 @@ func buildGstreamer(cmd string) error { " --build-arg GSTREAMER_VERSION=%s"+ " --build-arg LIBNICE_VERSION=%s"+ " -t livekit/gstreamer:%s-%s"+ + " -t livekit/gstreamer:%s-%s-%s"+ " -f build/gstreamer/Dockerfile-%s"+ " ./build/gstreamer", - cmd, gstVersion, libniceVersion, gstVersion, build, build, + cmd, gstVersion, libniceVersion, gstVersion, build, gstVersion, build, runtime.GOARCH, build, )) }