Your Name a76c302d7a feat: 添加种子数据和一键初始化脚本
- demo 账号: brand/agency/creator@demo.com
- 组织关系 + 项目/Brief + 4种阶段任务 + 规则数据 + 示例消息
- entrypoint.sh (Docker) + init_db.sh (手动) + start-dev.sh 更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 10:27:47 +08:00

59 lines
1.5 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ===========================
# 秒思智能审核平台 - Backend Dockerfile
# 多阶段构建,基于 python:3.13-slim
# ===========================
# ---------- Stage 1: 构建依赖 ----------
FROM python:3.13-slim AS builder
WORKDIR /build
# 安装编译依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# 复制依赖描述文件
COPY pyproject.toml .
# 安装 Python 依赖到 /build/deps
RUN pip install --no-cache-dir --prefix=/build/deps .
# ---------- Stage 2: 运行时镜像 ----------
FROM python:3.13-slim AS runtime
WORKDIR /app
# 安装运行时系统依赖FFmpeg 用于视频处理libpq 用于 PostgreSQL
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libpq5 \
curl \
&& rm -rf /var/lib/apt/lists/*
# 从 builder 阶段复制已安装的 Python 依赖
COPY --from=builder /build/deps /usr/local
# 复制应用代码
COPY app/ ./app/
COPY alembic/ ./alembic/
COPY alembic.ini .
COPY pyproject.toml .
COPY scripts/ ./scripts/
# 创建非 root 用户
RUN groupadd -r miaosi && useradd -r -g miaosi -d /app -s /sbin/nologin miaosi \
&& mkdir -p /tmp/videos \
&& chown -R miaosi:miaosi /app /tmp/videos
USER miaosi
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
ENTRYPOINT ["./scripts/entrypoint.sh"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]