build: 将前后端端口迁移至 7380/7381

固定前端端口为 7380、后端端口为 7381,避开 3000/5173/8080
等常见开发端口,防止与同机其它工程互占。

- 更新根目录、backend、web 的 .env.example 与 README、Makefile 说明
- 同步 vite.config.ts、web/package.json、desktop/main.cjs 默认地址
- 同步 backend config.go 默认端口常量、Dockerfile 与 docker-compose 健康检查
- 同步 deploy/nginx.conf 监听与反代、Dockerfile.web 端口
- 后端新增 godotenv 加载 backend/.env,真实环境变量优先
- AGENTS.md 补充端口约定与按 PID 清理进程的强制规范
- 新增 preflight 脚本并在 pnpm dev 前执行
This commit is contained in:
tongtong committed 2026-09-21 13:32:14 +08:00
1 parent 943c0a0e5a
commit ae6cdf1551
19 files changed
+149 -35

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
# 开发服务器把 /api 代理到该地址
VITE_API_PROXY_TARGET=http://127.0.0.1:8080
# 开发服务器把 /api 代理到该地址(后端端口 7381)
VITE_API_PROXY_TARGET=http://127.0.0.1:7381
# 运行时请求前缀,生产环境由 nginx 反代
VITE_API_BASE_URL=/api
+2 -2
View File
@@ -4,9 +4,9 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0 --port 3000",
"dev": "vite --host 0.0.0.0 --port 7380",
"build": "tsc --noEmit && vite build",
"preview": "vite preview --host 0.0.0.0 --port 3000",
"preview": "vite preview --host 0.0.0.0 --port 7380",
"typecheck": "tsc --noEmit"
},
"dependencies": {
+7 -2
View File
@@ -3,9 +3,13 @@ import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from "vite";
// 本项目固定端口:前端 7380,后端 7381(见 AGENTS.md「端口约定」)
const WEB_PORT = 7380;
const API_PORT = 7381;
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const proxyTarget = env.VITE_API_PROXY_TARGET || "http://127.0.0.1:8080";
const proxyTarget = env.VITE_API_PROXY_TARGET || `http://127.0.0.1:${API_PORT}`;
return {
plugins: [react(), tailwindcss()],
@@ -16,7 +20,8 @@ export default defineConfig(({ mode }) => {
},
server: {
host: "0.0.0.0",
port: 3000,
port: WEB_PORT,
strictPort: true,
proxy: {
"/api": {
target: proxyTarget,