diff --git a/.dockerignore b/.dockerignore index a124525..19eac79 100644 --- a/.dockerignore +++ b/.dockerignore @@ -27,6 +27,4 @@ data/api-endpoint-inventory.txt data/fetch-images.py # 杂项 -image.png -3D窗型.png .env diff --git a/Dockerfile b/Dockerfile index cff567e..4558b47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ # syntax=docker/dockerfile:1 # 华门窗云平台镜像(多阶段:前端构建 → Python 运行时) # 云端构建: git 仓库直接构建即可; 本地: docker build -t menchuang . +# 注: npm/PyPI 默认走国内镜像源(npmmirror/清华), 海外构建可用 --build-arg 覆盖 # ---------- 阶段 1: 前端构建 (Vue3 + Vite → dist) ---------- FROM node:22-alpine AS web WORKDIR /web +RUN npm config set registry https://registry.npmmirror.com COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci COPY frontend/ ./ @@ -12,11 +14,11 @@ RUN npm run build # ---------- 阶段 2: 后端运行时 (Python 3.14 + uv) ---------- FROM python:3.14-slim-bookworm - -# uv 包管理器(按 uv.lock 冻结安装) -COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /usr/local/bin/uv +# uv 经 PyPI 安装(避免对 ghcr.io 的依赖); 国内构建走清华源 +RUN pip install --no-cache-dir "uv>=0.9,<0.10" ENV UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy \ + UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple \ TZ=Asia/Shanghai WORKDIR /app