更新前后端配置并清理仓库内容

This commit is contained in:
2026-04-12 16:37:36 +08:00
parent dbd72610c1
commit d373ce1da9
20 changed files with 362 additions and 63 deletions

View File

@@ -8,6 +8,16 @@
---
## Docker 生产部署(预编译二进制)
1. **本机Windows**:在 `infogenie-backend-go` 目录运行 `build-linux-amd64.bat`,生成 `dist/server`Linux amd64
2. **构建镜像**`docker compose up -d --build`(默认使用 `Dockerfile.prebuilt`,不在服务器执行 `go build`)。
3. **若要在镜像内编译**`docker compose -f docker-compose.yml -f docker-compose.sourcebuild.yml up -d --build`(使用原 `Dockerfile` 多阶段构建)。
4. **端口**`docker-compose.yml` 映射 `12364:5002`;浏览器访问的 API 基址须与前端 `VITE_API_URL` 一致HTTPS 反代或公网可达地址)。
5. **`.env.production`**:容器内 `DB_HOST=127.0.0.1` 指向容器自身,**不能**访问宿主机 MySQL。MySQL/Redis 在宿主机时见仓库内 `.env.production.example` 注释(如 `172.17.0.1``host.docker.internal`)。`REDIS_ENABLED=true` 时 Redis 必须可达,否则进程启动即失败。
---
## 运行与配置
- 环境由 `**APP_ENV`** 决定:`development``production`(见 `config.Load()`)。