Docker化部署:多阶段构建 + docker-compose 编排;删除开发/内置服务器脚本;安全加固
This commit is contained in:
1 parent
044e526c80
commit
af98618810
15 files changed
+424
-127
No files matched your search
@@ -5,7 +5,7 @@ import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => ({
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
||||
@@ -19,6 +19,8 @@ export default defineConfig({
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 3000,
|
||||
strictPort: false,
|
||||
// 允许外部访问(开发模式下 nginx 反代需要,生产环境请用 npm run build)
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:8080',
|
||||
@@ -34,5 +36,9 @@ export default defineConfig({
|
||||
outDir: 'dist',
|
||||
assetsDir: 'assets',
|
||||
sourcemap: false,
|
||||
// 生产构建时注入环境变量提示
|
||||
define: mode === 'production' ? {} : {
|
||||
__DEV_SERVER_WARNING__: JSON.stringify('当前为开发模式, 生产环境请使用 npm run build 构建后部署')
|
||||
}
|
||||
}
|
||||
})
|
||||
}))
|
||||
Reference in new issue
Block a user