diff --git a/.github/workflows/release-containerimage.yml b/.github/workflows/release-containerimage.yml index ddee9d9..501dacb 100644 --- a/.github/workflows/release-containerimage.yml +++ b/.github/workflows/release-containerimage.yml @@ -1,48 +1,111 @@ name: Create and publish a Docker image -# Configures this workflow to run every time a change is pushed to the branch called `release`. on: workflow_dispatch: push: + paths-ignore: + - 'README.md' -# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: REGISTRY: ghcr.io - IMAGE_NAME: TechnoTUT/rtmp-live-server + IMAGE_NAME: ghcr.io/technotut/rtmp-live-server -# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: - build-and-push-image: - runs-on: ubuntu-latest - # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + build: + runs-on: ubuntu-24.04 permissions: contents: read packages: write - # + strategy: + matrix: + platform: + - linux/amd64 + - linux/arm64 steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//_}" >> $GITHUB_ENV + - name: Checkout repository uses: actions/checkout@v4 - # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. - - name: Log in to the Container registry + + - name: Log in to the container registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. - # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. - # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. - - name: Build and push Docker image - uses: docker/build-push-action@v5 + images: ${{ env.IMAGE_NAME }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v6 with: + platforms: ${{ matrix.platform }} context: . - file: ./Containerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + file: Containerfile + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_PAIR }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-24.04 + needs: build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true + + - name: Log in to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} \ No newline at end of file diff --git a/Containerfile b/Containerfile index 1d76f76..c4d8e97 100644 --- a/Containerfile +++ b/Containerfile @@ -1,8 +1,23 @@ -FROM alqutami/rtmp-hls:latest +FROM debian:13-slim + +LABEL maintainer="TechnoTUT " + +EXPOSE 1935 +EXPOSE 80 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update -y && apt-get upgrade -y \ + && apt-get install -y nginx libnginx-mod-rtmp \ + && rm -rf /var/lib/apt/lists/* \ + && ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log \ + && rm -rf /etc/nginx/nginx.conf \ + && rm -rf /var/www/html/favicon.ico \ + && mkdir -p /var/www/html/rtmp -RUN rm -rf /etc/nginx/nginx.conf && \ - rm -rf /usr/local/nginx/html/players && \ - rm -rf /usr/local/nginx/html/favicon.ico COPY nginx.conf /etc/nginx/nginx.conf -COPY players /usr/local/nginx/html/players -COPY favicon.ico /usr/local/nginx/html/favicon.ico +COPY favicon.ico /var/www/html/favicon.ico +COPY stat.xsl /var/www/html/rtmp/stat.xsl + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf index 433a822..bc2e40d 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,3 +1,5 @@ +load_module /usr/lib/nginx/modules/ngx_rtmp_module.so; + worker_processes auto; #error_log logs/error.log; @@ -10,17 +12,11 @@ rtmp { server { listen 1935; # Listen on standard RTMP port listen [::]:1935 ipv6only=on; - chunk_size 4000; + chunk_size 4096; application live { live on; - drop_idle_publisher 10s; - - hls on; - hls_fragment 3; - hls_playlist_length 20; - hls_path /mnt/hls/; - hls_variant _mid BANDWIDTH=448000; + record off; # Disable recording } } } @@ -35,31 +31,6 @@ http { listen 8080; listen [::]:8080 ipv6only=on; - # Serve HLS fragments - location /hls { - types { - application/vnd.apple.mpegurl m3u8; - video/mp2t ts; - } - - root /mnt; - - add_header Cache-Control no-cache; # Disable cache - - # CORS setup - add_header 'Access-Control-Allow-Origin' '*' always; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - - # allow CORS preflight requests - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } - } - # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; @@ -68,7 +39,7 @@ http { location /stat.xsl { # XML stylesheet to view RTMP stats. - root /usr/local/nginx/html; + root /var/www/html/rtmp; } } diff --git a/players/hls.html b/players/hls.html deleted file mode 100644 index 0e2ab74..0000000 --- a/players/hls.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - HLS Live Streaming - - - - - - - - - - - diff --git a/players/hls_hlsjs.html b/players/hls_hlsjs.html deleted file mode 100644 index 6e7ed79..0000000 --- a/players/hls_hlsjs.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - HLS streaming - - - - - - - - - -
-
- -
-
- - - - - - - diff --git a/players/rtmp.html b/players/rtmp.html deleted file mode 100644 index f5a7814..0000000 --- a/players/rtmp.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - RTMP Live Streaming - Live Streaming - - - - - - - - - - - - diff --git a/players/rtmp_hls.html b/players/rtmp_hls.html deleted file mode 100644 index 194d2d7..0000000 --- a/players/rtmp_hls.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Live Streaming - - - - - - - - - - - - - diff --git a/stat.xsl b/stat.xsl new file mode 100644 index 0000000..92d3d2b --- /dev/null +++ b/stat.xsl @@ -0,0 +1,355 @@ + + + + + + + + + + + + + RTMP statistics + + + +
+ Generated by + nginx-rtmp-module , + nginx , + pid , + built   + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RTMP#clientsVideoAudioIn bytesOut bytesIn bits/sOut bits/sStateTime
Accepted: codecbits/ssizefpscodecbits/sfreqchan + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + live streams + + + + + + + + + + + + vod streams + + + + + + + + + + + + + #cccccc + #dddddd + + + + + + var d=document.getElementById('-'); + d.style.display=d.style.display=='none'?'':'none'; + return false + + + + [EMPTY] + + + + + +    + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + +
IdStateAddressFlash versionPage URLSWF URLDroppedTimestampA-VTime
+ + +
+ + + + + + + + + + + d + + + + h + + + + m + + + s + + + + + + + + + + + + + T + + + G + + + M + + K + + + + b + B + + /s + + + + + + active + idle + + + + + + + publishing + playing + + + + + + + + + #cccccc + #eeeeee + + + + + + + + http://apps.db.ripe.net/search/query.html?searchtext= + + whois + + + + + + + + + + + + + + + + + + + + + + + + + + publishing + + + + active + + + + x + + +
\ No newline at end of file