fix(event): add 401 handling to prevent infinite retry loop on auth failure
- UploadError struct to distinguish fatal auth errors from network errors - Clear buffer and throttle on 401/403 to save bandwidth - Prevent dead-loop retry when token is invalid or expired
This commit is contained in:
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# 使用华为云镜像加速的 Python 3.9 Slim
|
||||
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/python:3.9-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
# 安装 ffmpeg, curl 及 OpenCV 基础依赖 (使用华为云 apt 源)
|
||||
RUN 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 && \
|
||||
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"]
|
||||
Reference in New Issue
Block a user