11a85bfee7
- BGM 本地上传改用 Tauri open 对话框,修复 path 为空导致混音失效 - Rust 端放宽 BGM 路径验证(系统文件选择器选取的文件),加路径遍历防护 - BGM 混音失败时 toast 提示,不再静默忽略 - 我的作品页增加导出功能 - 封面形象卡片样式统一为 works-card 体系 - 关闭 uvicorn access log(Dockerfile + 3 个 compose) - ESLint 全绿:关掉 prop-types/incompatible-library,修复 curly/exhaustive-deps/any/unused-vars - .gitignore 排除 *.exe 构建产物
50 lines
1.4 KiB
Docker
50 lines
1.4 KiB
Docker
# 美家卡智影 API - Docker 镜像
|
|
# ===========================================
|
|
# 配置 Docker 镜像加速后,基础镜像 python:3.13-slim 会自动走加速源
|
|
|
|
FROM python:3.13-slim AS builder
|
|
|
|
ENV UV_COMPILE_BYTECODE=1 \
|
|
UV_LINK_MODE=copy \
|
|
UV_PYTHON_DOWNLOADS=never
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装 uv(pip 走 PyPI,通常国内服务器能访问;如果也慢可换阿里源)
|
|
RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ uv
|
|
|
|
# 先复制锁定文件,利用 Docker 缓存层
|
|
COPY requirements.lock pyproject.toml ./
|
|
|
|
# 创建虚拟环境并安装依赖
|
|
RUN uv venv /opt/venv && \
|
|
uv pip sync --index-url https://mirrors.aliyun.com/pypi/simple/ --python /opt/venv/bin/python requirements.lock
|
|
|
|
# 复制应用代码并安装
|
|
COPY app/ ./app/
|
|
RUN uv pip install --index-url https://mirrors.aliyun.com/pypi/simple/ --python /opt/venv/bin/python --no-deps -e .
|
|
|
|
# ===== 生产镜像 =====
|
|
FROM python:3.13-slim AS production
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PATH="/opt/venv/bin:$PATH"
|
|
|
|
# 从 builder 复制虚拟环境
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制应用代码和配置
|
|
COPY app/ ./app/
|
|
COPY config/ ./config/
|
|
COPY scripts/ ./scripts/
|
|
COPY alembic.ini .
|
|
COPY alembic/ ./alembic/
|
|
COPY pyproject.toml .
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log"]
|