增加主力选股批量分析
This commit is contained in:
+26
-8
@@ -4,13 +4,21 @@ FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/python:3.12-slim
|
||||
# 设置时区环境变量
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
# 替换apt-get源为国内源(阿里源)
|
||||
RUN echo "deb https://mirrors.aliyun.com/debian/ bookworm main" > /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates main" >> /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.aliyun.com/debian-security bookworm-security main" >> /etc/apt/sources.list && \
|
||||
rm -rf /etc/apt/sources.list.d/* || true
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装Node.js (pywencai需要)、中文字体 (PDF生成需要) 和时区数据
|
||||
# 安装基础依赖、中文字体和时区数据
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gnupg \
|
||||
tar \
|
||||
xz-utils \
|
||||
ca-certificates \
|
||||
fonts-noto-cjk \
|
||||
fonts-wqy-zenhei \
|
||||
fonts-wqy-microhei \
|
||||
@@ -18,20 +26,31 @@ RUN apt-get update && apt-get install -y \
|
||||
tzdata \
|
||||
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& fc-cache -fv \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 安装Node.js(从淘宝镜像下载二进制包,最稳定快速的方案)
|
||||
RUN NODE_VERSION=18.20.4 && \
|
||||
ARCH=$(dpkg --print-architecture) && \
|
||||
if [ "$ARCH" = "amd64" ]; then NODE_ARCH="x64"; \
|
||||
elif [ "$ARCH" = "arm64" ]; then NODE_ARCH="arm64"; \
|
||||
else NODE_ARCH="$ARCH"; fi && \
|
||||
curl -fsSL https://registry.npmmirror.com/-/binary/node/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz -o /tmp/node.tar.gz && \
|
||||
tar -xzf /tmp/node.tar.gz -C /usr/local --strip-components=1 && \
|
||||
rm /tmp/node.tar.gz && \
|
||||
ln -s /usr/local/bin/node /usr/local/bin/nodejs
|
||||
|
||||
# 验证安装
|
||||
RUN node --version && npm --version
|
||||
|
||||
# 配置npm使用淘宝镜像源
|
||||
RUN npm config set registry https://registry.npmmirror.com/
|
||||
|
||||
# 复制依赖文件
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安装Python依赖 - 修改后的部分
|
||||
# 永久配置pip使用国内镜像源并增加超时时间[1](@ref)[2](@ref)
|
||||
# 安装Python依赖(使用清华源,更稳定)
|
||||
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ && \
|
||||
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
|
||||
pip install --no-cache-dir --default-timeout=1000 -r requirements.txt
|
||||
@@ -49,5 +68,4 @@ EXPOSE 8501
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
||||
|
||||
# 启动应用
|
||||
CMD ["python", "run.py"]
|
||||
|
||||
CMD ["python", "run.py"]
|
||||
Reference in New Issue
Block a user