diff --git a/.editorconfig b/.editorconfig index 6687730d9..886cff634 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,12 +23,12 @@ end_of_line = unset insert_final_newline = unset # Makefiles/Dockerfile/golang files -[{Makefile,Dockerfile{,.debian},*.go}] +[{Makefile,Dockerfile{,.cuda-base,.mediamtx},*.go}] indent_style = tab indent_size = 8 -# YAML/JSON Files -[{.ecrc,*.{yml,yaml,sh,json}}] +# YAML/JSON/sh Files +[{.ecrc,*.{yml,yaml,sh,json,bash}}] indent_size = 2 [{server/handlers_test,eth/accountmanager_test}.go] diff --git a/.github/labeler.yml b/.github/labeler.yml index 16b62af25..8d012f381 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -10,6 +10,11 @@ docker: - any-glob-to-any-file: - "docker/**" +docs: + - changed-files: + - any-glob-to-any-file: + - "doc/**" + github_actions: - changed-files: - any-glob-to-any-file: diff --git a/.github/workflows/docker-mediamtx.yaml b/.github/workflows/docker-mediamtx.yaml index d6540b4e5..dee3a31d1 100644 --- a/.github/workflows/docker-mediamtx.yaml +++ b/.github/workflows/docker-mediamtx.yaml @@ -2,12 +2,15 @@ name: MediaMTX Docker build on: pull_request: + branches: + - master + paths: + - 'docker/*mediamtx*' push: branches: - master paths: - - 'docker/Dockerfile.mediamtx' - - 'docker/mediamtx.yml' + - 'docker/*mediamtx*' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -20,7 +23,7 @@ jobs: permissions: packages: write contents: read - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v4.1.7 diff --git a/docker/Dockerfile.mediamtx b/docker/Dockerfile.mediamtx index 6c0181928..a6646a23d 100644 --- a/docker/Dockerfile.mediamtx +++ b/docker/Dockerfile.mediamtx @@ -1,17 +1,23 @@ -FROM ubuntu:24.04 - -ENV MEDIAMTX_VERSION="v1.9.3" +FROM ubuntu:24.04 # we need curl in the image as it's later used in the runOnReady command -RUN apt-get update \ - && apt-get install -y \ - ca-certificates \ - curl \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get update \ + && apt-get install -y \ + ca-certificates \ + curl \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV MEDIAMTX_VERSION="1.9.3" + +ADD "https://github.com/bluenviron/mediamtx/releases/download/v${MEDIAMTX_VERSION}/mediamtx_v${MEDIAMTX_VERSION}_linux_amd64.tar.gz" /opt/mediamtx.tar.gz + +RUN tar xzf /opt/mediamtx.tar.gz -C /opt/ \ + && mkdir -p /usr/local/bin /etc/mediamtx/ \ + && mv /opt/mediamtx /usr/local/bin/mediamtx \ + && mv /opt/mediamtx.yml /etc/mediamtx/mediamtx.yml \ + && rm -rf /opt/ -RUN curl -L https://github.com/bluenviron/mediamtx/releases/download/${MEDIAMTX_VERSION}/mediamtx_${MEDIAMTX_VERSION}_linux_amd64.tar.gz -o /mediamtx.tar.gz \ - && tar xzvf /mediamtx.tar.gz \ - && rm /mediamtx.tar.gz +COPY mediamtx-entry.bash / -ENTRYPOINT ["/mediamtx"] +ENTRYPOINT ["/mediamtx-entry.bash"] diff --git a/docker/mediamtx-entry.bash b/docker/mediamtx-entry.bash new file mode 100755 index 000000000..fc70db141 --- /dev/null +++ b/docker/mediamtx-entry.bash @@ -0,0 +1,19 @@ +#!/bin/bash + +[ -v DEBUG ] && set -x + +set -euo pipefail + +if [ -v LP_PUBLISH_MEDIAMTX_METRICS ]; then + if [ -z "$LP_PUBLISH_MEDIAMTX_METRICS_ENDPOINT" ]; then + echo >&2 "No endpoint specified for publishing mediamtx metrics." + fi + echo <