签入版本
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
# ======================================================================
|
||||
# 多阶段构建:Stage 1 构建依赖 -> Stage 2 运行
|
||||
# ======================================================================
|
||||
FROM python:3.12-slim AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# 复制依赖清单
|
||||
COPY pyproject.toml poetry.lock* ./
|
||||
|
||||
# 安装 poetry 并导出 requirements
|
||||
RUN pip install --no-cache-dir poetry \
|
||||
&& poetry export -f requirements.txt -o requirements.txt --without-hashes
|
||||
|
||||
# ======================================================================
|
||||
FROM python:3.12-slim AS runtime
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /data/apps
|
||||
|
||||
# 安装运行依赖
|
||||
COPY --from=builder /build/requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 复制项目文件
|
||||
COPY src ./src
|
||||
COPY app.py ./
|
||||
COPY alembic ./alembic
|
||||
COPY alembic.ini ./
|
||||
COPY .env.example ./.env
|
||||
COPY scripts ./scripts
|
||||
COPY templates ./templates
|
||||
COPY static ./static
|
||||
|
||||
# 创建运行时目录
|
||||
RUN mkdir -p uploads logs
|
||||
|
||||
EXPOSE 8041
|
||||
|
||||
# 启动应用
|
||||
CMD ["python", "app.py"]
|
||||
Reference in New Issue
Block a user