镜像制作

This commit is contained in:
2025-11-24 11:50:15 +08:00
parent 12592c5a24
commit 07bd166257
53 changed files with 3822 additions and 2140 deletions

View File

@@ -0,0 +1,57 @@
/**
* @description 应用配置 - Docker生产环境
* @author yslg
* @since 2025-10-18
*/
// 生产环境配置
const isDev = false;
// API 基础路径 - Docker环境使用相对路径
export const API_BASE_URL = '/schoolNewsServ';
// 文件下载路径
export const FILE_DOWNLOAD_URL = `${API_BASE_URL}/file/download/`;
// 应用配置
export const APP_CONFIG = {
// 应用标题
title: '校园新闻管理系统',
// 基础路径
baseUrl: '/schoolNewsWeb/',
// API 配置
api: {
baseUrl: API_BASE_URL,
timeout: 30000
},
// 文件配置
file: {
downloadUrl: FILE_DOWNLOAD_URL,
uploadUrl: `${API_BASE_URL}/file/upload`,
maxSize: {
image: 5, // MB
video: 100, // MB
document: 10 // MB
},
acceptTypes: {
image: 'image/*',
video: 'video/*',
document: '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx'
}
},
// Token 配置
token: {
key: 'token',
refreshThreshold: 5 * 60 * 1000 // 提前5分钟刷新
}
};
// 公共资源路径 - Docker环境
export const PUBLIC_IMG_PATH = '/schoolNewsWeb/img';
export const PUBLIC_WEB_PATH = '/schoolNewsWeb';
export default APP_CONFIG;

View File

@@ -0,0 +1,81 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
workbox: {
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true
}
})
],
// 基础路径
base: '/schoolNewsWeb/',
file: {
downloadUrl: "http://school-news-serv:8081/schoolNewsServ/file/download/"
},
// 输出目录
build: {
outDir: 'dist',
assetsDir: 'static',
sourcemap: false,
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'vuex'],
'element-plus': ['element-plus']
}
}
}
},
// 路径别名
resolve: {
alias: {
'@': resolve(__dirname, 'src')
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
// 环境变量
define: {
'process.env.BASE_URL': JSON.stringify('/schoolNewsWeb/'),
'process.env.VITE_API_BASE_URL': JSON.stringify('/api'),
'process.env.VITE_APP_TITLE': JSON.stringify('校园新闻管理系统')
},
// 开发服务器配置(生产环境无效)
server: {
host: '0.0.0.0',
port: 8080,
open: '/schoolNewsWeb/',
// 代理配置
proxy: {
'/api': {
target: 'http://school-news-serv:8081/schoolNewsServ',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
// CSS 配置
css: {
preprocessorOptions: {
scss: {
additionalData: ''
}
}
}
})