mirror of
https://github.com/gowvp/gb28181.git
synced 2026-04-22 23:17:19 +08:00
76 lines
2.7 KiB
Plaintext
76 lines
2.7 KiB
Plaintext
# 使用 Debian Bullseye 作为基础镜像,因为 ZLMediaKit 需要 libssl1.1
|
||
FROM debian:trixie-slim
|
||
|
||
ENV TZ=Asia/Shanghai
|
||
ENV PYTHONDONTWRITEBYTECODE=1
|
||
ENV PYTHONUNBUFFERED=1
|
||
ENV PYTHONPATH=/opt/media/bin/analysis
|
||
|
||
WORKDIR /opt/media/bin/
|
||
|
||
# 配置 apt 源使用阿里云镜像 (Trixie 使用新格式 sources.list.d/debian.sources)
|
||
RUN sed -i 's|http://deb.debian.org|http://mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
||
sed -i 's|http://deb.debian.org|http://mirrors.aliyun.com|g; \
|
||
s|http://security.debian.org|http://mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true
|
||
|
||
# 安装运行时依赖
|
||
# - python3/pip: AI 分析模块
|
||
# - libgl1/libglib2.0-0: OpenCV 需要
|
||
# 注意:Trixie 没有 libssl1.1,需要从 Bullseye 仓库安装
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
ca-certificates \
|
||
tzdata \
|
||
libstdc++6 \
|
||
libgcc-s1 \
|
||
libssl3 \
|
||
python3 \
|
||
python3-pip \
|
||
libgl1 \
|
||
libglib2.0-0 \
|
||
wget \
|
||
&& rm -rf /var/lib/apt/lists/* \
|
||
&& apt-get clean
|
||
|
||
# 从 Debian Bullseye 下载并安装 libssl1.1(ZLMediaKit 需要)
|
||
RUN wget -q http://mirrors.aliyun.com/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_amd64.deb -O /tmp/libssl1.1_amd64.deb \
|
||
&& wget -q http://mirrors.aliyun.com/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb -O /tmp/libssl1.1_arm64.deb \
|
||
&& dpkg -i /tmp/libssl1.1_$(dpkg --print-architecture).deb || true \
|
||
&& rm -f /tmp/libssl1.1_*.deb
|
||
|
||
# 配置 pip 使用阿里云镜像
|
||
RUN pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ \
|
||
&& pip3 config set global.trusted-host mirrors.aliyun.com
|
||
|
||
# 安装 Python 依赖
|
||
# --break-system-packages: Debian Trixie 使用 PEP 668 保护系统 Python
|
||
COPY ./analysis/requirements.txt /tmp/requirements.txt
|
||
RUN pip3 install --no-cache-dir --break-system-packages -r /tmp/requirements.txt \
|
||
&& rm /tmp/requirements.txt \
|
||
&& rm -rf /root/.cache/pip
|
||
|
||
# 从外部镜像复制 ZLMediaKit 和 ffmpeg
|
||
COPY --from=zlmediakit/zlmediakit:master /opt/media/bin /opt/media/bin
|
||
COPY --from=mwader/static-ffmpeg:6.1 /ffmpeg /usr/local/bin/ffmpeg
|
||
COPY --from=mwader/static-ffmpeg:6.1 /ffprobe /usr/local/bin/ffprobe
|
||
|
||
# 复制应用文件
|
||
ADD ./build/linux_amd64/bin ./gowvp
|
||
ADD ./www ./www
|
||
ADD ./analysis ./analysis
|
||
|
||
RUN mkdir -p configs
|
||
|
||
RUN ln -sf /usr/local/bin/ffmpeg /usr/bin/ffmpeg && \
|
||
chmod +x /usr/local/bin/ffmpeg
|
||
|
||
RUN ln -sf /usr/local/bin/ffmpeg /opt/media/bin/ffmpeg
|
||
|
||
LABEL Name=gowvp \
|
||
Version=0.1.0 \
|
||
Maintainer="xx@golang.space" \
|
||
Description="gowvp & zlmediakit & ai (ONNX Runtime)"
|
||
|
||
EXPOSE 15123 1935 8080 554 50051 20000-20100/udp 20000-20100
|
||
|
||
CMD ["./gowvp"]
|