源修改

This commit is contained in:
2025-11-26 14:13:17 +08:00
parent 20388fc818
commit 095f832fe6
3 changed files with 100 additions and 67 deletions

View File

@@ -33,6 +33,8 @@ COPY schoolNewsCrawler/requirements.txt /tmp/requirements.txt
RUN echo "========================================" && \
echo "安装Python爬虫依赖到基础镜像" && \
echo "========================================" && \
# 配置pip使用国内镜像源清华源
python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip --version && \
echo "" && \
# Python 3.12 引入了 PEP 668 规范,需要添加 --break-system-packages

View File

@@ -9,8 +9,10 @@ FROM node:20-alpine
ENV TZ=Asia/Shanghai \
NODE_ENV=production
# 安装基础工具
RUN apk add --no-cache tzdata bash curl && \
# 配置国内镜像源并安装基础工具
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add --no-cache tzdata bash curl && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
@@ -24,7 +26,8 @@ RUN mkdir -p /app/dist /app/config /app/logs
COPY schoolNewsWeb/package*.json ./
# 安装生产依赖包括vite用于preview
RUN npm ci --only=production && \
RUN npm config set registry https://registry.npmmirror.com && \
npm ci --only=production && \
npm install -g vite
# 从主机复制已构建的dist目录