Update Docker runtime to pull latest code on startup.
Install git in image and change start script to clone/pull target branch, reinstall dependencies, rebuild frontend, then launch backend and frontend services. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
10
README.md
10
README.md
@@ -58,7 +58,7 @@ npm run dev
|
||||
|
||||
## Docker 单容器运行
|
||||
|
||||
项目提供了单容器运行前后端的 `Dockerfile`,容器内会同时启动:
|
||||
项目提供了单容器运行前后端的 `Dockerfile`,容器启动时会先从 Git 拉取最新代码,然后再启动:
|
||||
|
||||
- Flask 后端:`14620`
|
||||
- 前端预览服务:`14621`
|
||||
@@ -76,6 +76,14 @@ docker run --rm -it \
|
||||
-p 14620:14620 \
|
||||
-p 14621:14621 \
|
||||
--env-file backend/.env \
|
||||
-e GIT_REPO_URL=https://git.rc707blog.top/rose_cat707/media_crawler.git \
|
||||
-e GIT_BRANCH=main \
|
||||
media-crawler:latest
|
||||
```
|
||||
|
||||
可选环境变量:
|
||||
|
||||
- `GIT_REPO_URL`:容器启动时拉取代码的仓库地址
|
||||
- `GIT_BRANCH`:拉取分支(默认 `main`)
|
||||
- `WORKTREE_DIR`:容器内代码目录(默认 `/app/runtime`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user