# 构建镜像:编译环境 + 预编译的依赖(国内镜像源版本) # 构建命令: docker build -f Dockerfile.base.local -t aether-base:latest . FROM python:3.12-slim WORKDIR /app # 构建工具(使用清华镜像源) RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \ apt-get update && apt-get install -y \ libpq-dev \ gcc \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # pip 镜像源 RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple # Python 依赖 COPY pyproject.toml README.md ./ RUN mkdir -p src && touch src/__init__.py && \ SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 pip install --no-cache-dir . && \ pip cache purge # 前端构建(使用淘宝镜像源) COPY frontend/ ./frontend/ RUN cd frontend && npm config set registry https://registry.npmmirror.com && \ npm ci && npm run build && rm -rf node_modules && npm cache clean --force # 产物位置: # - Python 包: /usr/local/lib/python3.12/site-packages # - Python 可执行文件: /usr/local/bin # - 前端构建产物: /app/frontend/dist