feat(docker): 重构Docker配置以支持生产环境部署

- 添加Dockerfile.dev用于开发环境
- 重构主Dockerfile使用多阶段构建
- 添加nginx配置和entrypoint脚本
- 更新docker-compose.yml配置
- 修改API基础路径为相对路径
- 更新vite配置支持环境变量
This commit is contained in:
史悦
2026-01-22 16:28:55 +08:00
parent 4186c4289b
commit 8eb5499ecc
10 changed files with 132 additions and 23 deletions

View File

@@ -1,17 +1,32 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
host: '0.0.0.0', // 允许通过 IP 访问
port: 5173, // 你可以根据需要修改端口
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [vue()],
server: {
host: '0.0.0.0',
port: 5173,
proxy: {
'/api/chat': {
target: env.VITE_API_BASE_URL || 'https://thinkflow.lz-t.top',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/chat/, '/chat/completions')
},
'/api/image': {
target: env.VITE_API_BASE_URL || 'https://thinkflow.lz-t.top',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/image/, '/images/generations')
}
}
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
}
})