- Dockerfile: support both legacy sources.list and DEB822 format for apt mirror - Dockerfile: use official python:3.9-slim instead of Huawei Cloud SWR mirror - .dockerignore: exclude !build/edge-agent to avoid build artifact in context - edge.yaml: change cloud_url from 8004 to 9000 (stream-gateway) - edge.yaml: change ota_url from 8087 to 9000 - Add Dockerfile.bak and buildkitd.toml
45 lines
1.8 KiB
Docker
45 lines
1.8 KiB
Docker
# 使用华为云镜像加速的 Python 3.9 Slim
|
|
FROM python:3.9-slim
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
# 替换 apt 源为华为云镜像(兼容 Debian 11 旧格式和 Debian 12/13 DEB822 格式)
|
|
RUN if [ -f /etc/apt/sources.list ]; then \
|
|
sed -i 's/deb.debian.org/repo.huaweicloud.com/g' /etc/apt/sources.list && \
|
|
sed -i 's/security.debian.org/repo.huaweicloud.com/g' /etc/apt/sources.list; \
|
|
fi && \
|
|
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
|
|
sed -i 's|https\?://deb.debian.org|http://repo.huaweicloud.com|g' /etc/apt/sources.list.d/debian.sources && \
|
|
sed -i 's|https\?://security.debian.org|http://repo.huaweicloud.com|g' /etc/apt/sources.list.d/debian.sources; \
|
|
fi && \
|
|
apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg curl libgl1 libglib2.0-0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /opt/tianyan
|
|
|
|
# 1. 复制已编译的 Go 二进制 (由宿主机构建)
|
|
COPY build/edge-agent /opt/tianyan/edge-agent
|
|
|
|
# 2. 安装 Python 依赖 (使用华为云 pip 源)
|
|
COPY python/requirements.txt .
|
|
RUN pip3 install --no-cache-dir -r requirements.txt -i https://repo.huaweicloud.com/repository/pypi/simple \
|
|
&& rm -rf /root/.cache/pip
|
|
|
|
# 3. 复制业务代码与脚本
|
|
COPY python/ /opt/tianyan/python/
|
|
COPY scripts/ /opt/tianyan/scripts/
|
|
|
|
# 4. 创建运行时目录
|
|
RUN mkdir -p /opt/tianyan/config /opt/tianyan/model /tmp
|
|
|
|
# 环境变量 (CANN 路径将由 docker-compose 挂载覆盖)
|
|
ENV PYTHONPATH=/usr/local/Ascend/ascend-toolkit/latest/python/site-packages
|
|
ENV LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/lib64:/usr/local/Ascend/driver/lib64
|
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
# 启动脚本
|
|
COPY entrypoint.sh /opt/tianyan/entrypoint.sh
|
|
RUN chmod +x /opt/tianyan/entrypoint.sh
|
|
|
|
ENTRYPOINT ["/opt/tianyan/entrypoint.sh"]
|