2025-07-19 17:31:27 +08:00
|
|
|
|
FROM python:3.11
|
2025-07-19 17:17:27 +08:00
|
|
|
|
|
2025-07-19 17:34:28 +08:00
|
|
|
|
# 兼容新老 debian/ubuntu 换源
|
|
|
|
|
RUN (sed -i 's@http://deb.debian.org@http://mirrors.aliyun.com@g' /etc/apt/sources.list 2>/dev/null || true) && \
|
|
|
|
|
(sed -i 's@http://security.debian.org@http://mirrors.aliyun.com@g' /etc/apt/sources.list 2>/dev/null || true) && \
|
|
|
|
|
find /etc/apt/sources.list.d/ -name "*.list" -exec sed -i 's@http://deb.debian.org@http://mirrors.aliyun.com@g' {} \; && \
|
|
|
|
|
find /etc/apt/sources.list.d/ -name "*.list" -exec sed -i 's@http://security.debian.org@http://mirrors.aliyun.com@g' {} \;
|
2025-07-19 17:28:11 +08:00
|
|
|
|
|
2025-07-19 17:17:27 +08:00
|
|
|
|
# 安装 Node.js 和 supervisord
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
|
apt-get install -y curl supervisor && \
|
|
|
|
|
curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
|
|
|
|
|
apt-get install -y nodejs && \
|
|
|
|
|
apt-get clean
|
|
|
|
|
|
2025-07-19 17:28:11 +08:00
|
|
|
|
# 设置 pip 国内镜像(清华)
|
|
|
|
|
RUN mkdir -p /root/.pip && \
|
|
|
|
|
echo "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple\ntrusted-host = pypi.tuna.tsinghua.edu.cn" > /root/.pip/pip.conf
|
|
|
|
|
|
2025-07-19 17:17:27 +08:00
|
|
|
|
# 设置工作目录
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# 复制前端代码并安装依赖、构建
|
|
|
|
|
COPY platform/ ./platform/
|
|
|
|
|
WORKDIR /app/platform
|
2025-07-19 19:42:56 +08:00
|
|
|
|
# 构建前先删除 dist,确保不会用到本地遗留产物
|
|
|
|
|
RUN rm -rf dist && npm install && npm run build
|
2025-07-19 18:24:49 +08:00
|
|
|
|
RUN ls -l /app/platform
|
2025-07-19 17:17:27 +08:00
|
|
|
|
|
|
|
|
|
# 安装 http-server
|
|
|
|
|
RUN npm install -g http-server
|
|
|
|
|
|
|
|
|
|
# 复制后端代码并安装依赖
|
|
|
|
|
WORKDIR /app/back
|
|
|
|
|
COPY back/requirements.txt .
|
2025-07-19 21:04:27 +08:00
|
|
|
|
RUN pip install -r requirements.txt
|
2025-07-19 17:17:27 +08:00
|
|
|
|
COPY back/ .
|
2025-07-19 18:24:49 +08:00
|
|
|
|
RUN ls -l /app/back
|
2025-07-19 17:17:27 +08:00
|
|
|
|
|
|
|
|
|
# supervisor 配置
|
|
|
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|