This commit is contained in:
jeremygan2021
2026-02-10 22:16:48 +08:00
parent 6328e1d644
commit 15c3954e75
3 changed files with 21 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ services:
build:
context: ./frontend
args:
- VITE_API_URL=http://6.6.6.66:8000/api
- VITE_API_URL=/api
# volumes:
# - ./frontend:/app
# - /app/node_modules

View File

@@ -12,7 +12,7 @@ RUN npm install --registry=https://registry.npmmirror.com
COPY . .
# 接收构建参数
ARG VITE_API_URL=http://localhost:8000/api
ARG VITE_API_URL=/api
# 设置环境变量供构建时使用
ENV VITE_API_URL=$VITE_API_URL

View File

@@ -12,6 +12,24 @@ export default defineConfig({
preview: {
host: '0.0.0.0',
port: 15173,
allowedHosts: ['market.quant-speed.com']
allowedHosts: ['market.quant-speed.com'],
proxy: {
'/api': {
target: 'http://backend:8000',
changeOrigin: true,
},
'/admin': {
target: 'http://backend:8000',
changeOrigin: true,
},
'/static': {
target: 'http://backend:8000',
changeOrigin: true,
},
'/media': {
target: 'http://backend:8000',
changeOrigin: true,
}
}
}
})