修改docker-compose.dev

This commit is contained in:
xie7654
2025-07-04 13:12:32 +08:00
parent 562615cd1d
commit a5807e3fba
15 changed files with 127 additions and 65 deletions

View File

@@ -4,7 +4,8 @@ VITE_PORT=5678
VITE_BASE=/
# 接口地址
VITE_GLOB_API_URL=http://127.0.0.1:8000/api
VITE_GLOB_API_URL=/api
VITE_BACKEND_URL=http://localhost:8000
# 是否开启 Nitro Mock服务true 为开启false 为关闭
VITE_NITRO_MOCK=false

View File

@@ -0,0 +1 @@
VITE_BACKEND_URL=http://backend:8000

View File

@@ -1,17 +1,20 @@
import { defineConfig } from '@vben/vite-config';
export default defineConfig(async () => {
import { loadEnv } from 'vite';
export default defineConfig(async ({ mode }) => {
// eslint-disable-next-line n/prefer-global/process
const env = loadEnv(mode, process.cwd(), '');
return {
application: {},
vite: {
server: {
host: '0.0.0.0', // 保证 docker 内外都能访问
port: 5678,
proxy: {
'/api': {
target: env.VITE_BACKEND_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址
target: 'http://localhost:5320/api',
ws: true,
},
},
},