Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

feat:增加清洗数据脚本编译执行

jiangzja93aea254326
diff --git a/Dockerfile b/Dockerfile
index 2a16768..c045e3b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,7 @@ ARG NPM_REGISTRY=
# 配置 npm 镜像源(条件执行)
ENV NPM_REGISTRY=${NPM_REGISTRY:-}
RUN if [ -n "$NPM_REGISTRY" ]; then \
- npm config set registry "$NPM_REGISTRY" || true; \
+ npm config set registry "$NPM_REGISTRY" || true; \
fi
WORKDIR /app/web
@@ -45,7 +45,7 @@ ARG ALPINE_MIRROR=
# 配置 Alpine 镜像源(条件执行)
ENV ALPINE_MIRROR=${ALPINE_MIRROR:-}
RUN if [ -n "$ALPINE_MIRROR" ]; then \
- sed -i "[email protected]@$ALPINE_MIRROR@g" /etc/apk/repositories 2>/dev/null || true; \
+ sed -i "[email protected]@$ALPINE_MIRROR@g" /etc/apk/repositories 2>/dev/null || true; \
fi
# 配置 Go 代理(使用 ENV 持久化到运行时)
@@ -75,6 +75,9 @@ COPY --from=frontend-builder /app/web/dist ./web/dist
# 构建后端可执行文件(纯 Go 编译,使用 modernc.org/sqlite)
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o huobao-drama .
+# 构建迁移脚本可执行文件
+RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o migrate cmd/migrate/main.go
+
# ==================== 阶段3: 运行时镜像 ====================
# 每个阶段前重新声明构建参数
ARG DOCKER_REGISTRY=
@@ -88,7 +91,7 @@ ARG ALPINE_MIRROR=
# 配置 Alpine 镜像源(条件执行)
ENV ALPINE_MIRROR=${ALPINE_MIRROR:-}
RUN if [ -n "$ALPINE_MIRROR" ]; then \
- sed -i "[email protected]@$ALPINE_MIRROR@g" /etc/apk/repositories 2>/dev/null || true; \
+ sed -i "[email protected]@$ALPINE_MIRROR@g" /etc/apk/repositories 2>/dev/null || true; \
fi
# 安装运行时依赖
@@ -106,6 +109,7 @@ WORKDIR /app
# 从构建阶段复制可执行文件
COPY --from=backend-builder /app/huobao-drama .
+COPY --from=backend-builder /app/migrate .
# 复制前端构建产物
COPY --from=frontend-builder /app/web/dist ./web/dist
diff --git a/MIGRATE_README.md b/MIGRATE_README.md
index 8a7c084..0784de5 100644
--- a/MIGRATE_README.md
+++ b/MIGRATE_README.md
@@ -2,21 +2,32 @@
## 使用方法
-### 方式一:直接运行(推荐)
+### 本地部署
```bash
# 在项目根目录执行
go run cmd/migrate/main.go
```
-### 方式二:编译后运行
+### Docker 部署
+
+在 Docker 容器中,迁移脚本已经被编译为可执行文件 `migrate`。
```bash
-# 编译
-go build -o migrate cmd/migrate/main.go
+# 进入容器
+docker exec -it huobao-drama sh
-# 运行
+# 在容器内执行迁移脚本
./migrate
+
+# 执行完成后,退出容器
+exit
+```
+
+或者直接执行(不进入容器):
+
+```bash
+docker exec huobao-drama ./migrate
```
## 配置要求
diff --git a/docker-compose.yml b/docker-compose.yml
index 807ae5e..32323ce 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,6 @@
services:
huobao-drama:
- image: huobao-drama:latest
+ # image: huobao-drama:latest
container_name: huobao-drama
build:
context: .