mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-06 10:57:50 +08:00
新增带pymkui后台管理的docker镜像
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
DockerPy / build (push) Has been cancelled
Linux / build (push) Has been cancelled
Linux_Python / build (push) Has been cancelled
macOS / build (push) Has been cancelled
macOS_Python / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Windows_Python / build (push) Has been cancelled
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
DockerPy / build (push) Has been cancelled
Linux / build (push) Has been cancelled
Linux_Python / build (push) Has been cancelled
macOS / build (push) Has been cancelled
macOS_Python / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Windows_Python / build (push) Has been cancelled
This commit is contained in:
parent
0efa1be502
commit
35d698672f
89
.github/workflows/docker_py.yml
vendored
Normal file
89
.github/workflows/docker_py.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
name: DockerPy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "feature/*"
|
||||
- "release/*"
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: docker.io
|
||||
IMAGE_NAME: zlmediakit/zlmediakit
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# This is used to complete the identity challenge
|
||||
# with sigstore/fulcio when running outside of PRs.
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 下载submodule源码
|
||||
run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
|
||||
|
||||
# Install the cosign tool except on PR
|
||||
# https://github.com/sigstore/cosign-installer
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@d572c9c13673d2e0a26fabf90b5748f36886883f
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
|
||||
# Workaround: https://github.com/docker/build-push-action/issues/461
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
|
||||
|
||||
# Login against a Docker registry except on PR
|
||||
# https://github.com/docker/login-action
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: zlmediakit
|
||||
password: ${{ secrets.DOCKER_IO_SECRET }}
|
||||
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push Docker image
|
||||
if: github.event_name != 'pull_request' && github.ref != 'refs/heads/feature/test'
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}_py
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: MODEL=Release
|
||||
file: ./dockerfile_py
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
# Sign the resulting Docker image digest except on PRs.
|
||||
# This will only write to the public Rekor transparency log when the Docker
|
||||
# repository is public to avoid leaking data. If you would like to publish
|
||||
# transparency data even for private images, pass --force to cosign below.
|
||||
# https://github.com/sigstore/cosign
|
||||
# - name: Sign the published Docker image
|
||||
# if: ${{ github.event_name != 'pull_request' }}
|
||||
# env:
|
||||
# COSIGN_EXPERIMENTAL: "true"
|
||||
# # This step uses the identity token to provision an ephemeral certificate
|
||||
# # against the sigstore community Fulcio instance.
|
||||
# run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}
|
||||
@ -214,6 +214,11 @@ zlmediakit采用 github action 持续集成自动编译打包上传编译产出
|
||||
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
|
||||
```
|
||||
|
||||
```bash
|
||||
# 此镜像为github action 持续集成自动编译推送,跟代码(master分支)保持最新状态, 并开启了pymkui后台管理系统,支持web管理界面
|
||||
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master_py
|
||||
```
|
||||
|
||||
你也可以根据Dockerfile编译镜像:
|
||||
|
||||
```bash
|
||||
|
||||
@ -367,6 +367,11 @@ You can download the pre-compiled image from Docker Hub and start it:
|
||||
#This image is pushed by the GitHub continuous integration automatic compilation to keep up with the latest code (master branch)
|
||||
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
|
||||
```
|
||||
```bash
|
||||
# This image is automatically built and pushed via GitHub Actions CI, stays up-to-date with the latest code (master branch),
|
||||
# and includes the pymkui backend management system with a web-based UI.
|
||||
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master_py
|
||||
```
|
||||
|
||||
You can also compile the image based on the Dockerfile:
|
||||
|
||||
|
||||
130
dockerfile_py
Normal file
130
dockerfile_py
Normal file
@ -0,0 +1,130 @@
|
||||
FROM ubuntu:24.04 AS build
|
||||
#shell,rtmp,rtsp,rtsps,http,https,rtp
|
||||
EXPOSE 1935/tcp
|
||||
EXPOSE 554/tcp
|
||||
EXPOSE 80/tcp
|
||||
EXPOSE 443/tcp
|
||||
EXPOSE 10000/udp
|
||||
EXPOSE 10000/tcp
|
||||
EXPOSE 8000/udp
|
||||
EXPOSE 8000/tcp
|
||||
EXPOSE 9000/udp
|
||||
|
||||
# 设置环境变量,避免交互提示
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
build-essential \
|
||||
cmake \
|
||||
curl \
|
||||
unzip \
|
||||
zip \
|
||||
nasm \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
autoconf-archive \
|
||||
pkg-config \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswscale-dev \
|
||||
libavfilter-dev \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN git clone https://github.com/ZLMediaKit/pymkui.git /opt/media/ZLMediaKit/pymkui
|
||||
|
||||
# 克隆 vcpkg 并编译
|
||||
RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \
|
||||
&& /opt/vcpkg/bootstrap-vcpkg.sh
|
||||
|
||||
# 将 vcpkg 路径加入环境变量
|
||||
ENV PATH="/opt/vcpkg:$PATH"
|
||||
ENV VCPKG_ROOT=/opt/vcpkg
|
||||
ENV CMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
# 自动选择 triplet(x64-linux 或 arm64-linux)
|
||||
RUN ARCH=$(dpkg --print-architecture) && \
|
||||
if [ "$ARCH" = "amd64" ]; then \
|
||||
TRIPLET="x64-linux"; \
|
||||
elif [ "$ARCH" = "arm64" ]; then \
|
||||
TRIPLET="arm64-linux"; \
|
||||
else \
|
||||
echo "Unsupported architecture: $ARCH" && exit 1; \
|
||||
fi && \
|
||||
echo "Using vcpkg triplet: $TRIPLET" && \
|
||||
/opt/vcpkg/vcpkg install jemalloc openssl libsrtp[openssl] --triplet $TRIPLET-dynamic
|
||||
|
||||
|
||||
RUN mkdir -p /opt/media
|
||||
COPY . /opt/media/ZLMediaKit
|
||||
WORKDIR /opt/media/ZLMediaKit
|
||||
|
||||
RUN mkdir -p build release/linux/Release/lib
|
||||
|
||||
# 根据 dpkg 架构选择 vcpkg 动态库路径
|
||||
RUN ARCH=$(dpkg --print-architecture) && \
|
||||
if [ "$ARCH" = "amd64" ]; then VCPKG_LIB_PATH="/opt/vcpkg/installed/x64-linux-dynamic/lib"; \
|
||||
elif [ "$ARCH" = "arm64" ]; then VCPKG_LIB_PATH="/opt/vcpkg/installed/arm64-linux-dynamic/lib"; \
|
||||
else echo "Unsupported architecture: $ARCH" && exit 1; fi && \
|
||||
echo "Copying libs from $VCPKG_LIB_PATH" && \
|
||||
cp -rfP $VCPKG_LIB_PATH/* release/linux/Release/lib/
|
||||
|
||||
WORKDIR /opt/media/ZLMediaKit/build
|
||||
|
||||
RUN ARCH=$(dpkg --print-architecture) && \
|
||||
if [ "$ARCH" = "amd64" ]; then TRIPLET="x64-linux"; \
|
||||
elif [ "$ARCH" = "arm64" ]; then TRIPLET="arm64-linux"; \
|
||||
else echo "Unsupported architecture: $ARCH" && exit 1; fi && \
|
||||
echo "Using vcpkg triplet: $TRIPLET" && \
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
|
||||
-DVCPKG_TARGET_TRIPLET=${TRIPLET}-dynamic \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_PYTHON=ON \
|
||||
-DPython3_EXECUTABLE=$(which python3) \
|
||||
-DENABLE_WEBRTC=ON -DENABLE_FFMPEG=ON \
|
||||
-DENABLE_TESTS=OFF -DENABLE_API=OFF .. && \
|
||||
make -j $(nproc)
|
||||
|
||||
FROM ubuntu:24.04
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswscale-dev \
|
||||
libavfilter-dev \
|
||||
ffmpeg \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone && \
|
||||
mkdir -p /opt/media/bin/www && mkdir -p /opt/media/bin/lib
|
||||
|
||||
WORKDIR /opt/media/bin/
|
||||
|
||||
COPY --from=build /opt/media/ZLMediaKit/release/linux/Release/MediaServer /opt/media/ZLMediaKit/default.pem /opt/media/bin/
|
||||
COPY --from=build /opt/media/ZLMediaKit/release/linux/Release/lib /opt/media/bin/lib
|
||||
COPY --from=build /opt/media/ZLMediaKit/release/linux/Release/config.ini /opt/media/conf/
|
||||
RUN echo -e "\n[python]\nplugin=mk_plugin" >> /opt/media/conf/config.ini
|
||||
COPY --from=build /opt/media/ZLMediaKit/www/ /opt/media/bin/www/
|
||||
COPY --from=build /opt/media/ZLMediaKit/pymkui /opt/media/bin/pymkui
|
||||
RUN pip3 install --no-cache-dir --break-system-packages -r /opt/media/bin/pymkui/backend/requirements.txt
|
||||
ENV PATH="/opt/media/bin:$PATH"
|
||||
ENV PYTHONPATH="/opt/media/bin/pymkui/backend"
|
||||
ENV LD_LIBRARY_PATH="/opt/media/bin/lib"
|
||||
CMD ["./MediaServer","-s", "default.pem", "-c", "../conf/config.ini", "-l","1"]
|
||||
Loading…
Reference in New Issue
Block a user