docker 支持
This commit is contained in:
@@ -20,5 +20,4 @@ VUE_APP_TENANT_ENABLE = true
|
|||||||
# 文档的开关
|
# 文档的开关
|
||||||
VUE_APP_DOC_ENABLE = true
|
VUE_APP_DOC_ENABLE = true
|
||||||
|
|
||||||
# 百度统计
|
|
||||||
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab
|
|
||||||
|
|||||||
@@ -16,5 +16,4 @@ VUE_APP_TENANT_ENABLE = true
|
|||||||
# 文档的开关
|
# 文档的开关
|
||||||
VUE_APP_DOC_ENABLE = true
|
VUE_APP_DOC_ENABLE = true
|
||||||
|
|
||||||
# 百度统计
|
|
||||||
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ENV = 'production'
|
|||||||
VUE_APP_TITLE = 农场管理系统
|
VUE_APP_TITLE = 农场管理系统
|
||||||
|
|
||||||
# 农场管理系统/生产环境
|
# 农场管理系统/生产环境
|
||||||
VUE_APP_BASE_API = 'https://bxg.api.cyjyyjy.com'
|
VUE_APP_BASE_API = '/admin-api'
|
||||||
|
|
||||||
# 根据服务器或域名修改
|
# 根据服务器或域名修改
|
||||||
#PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
|
#PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
|
||||||
@@ -20,5 +20,3 @@ VUE_APP_TENANT_ENABLE = true
|
|||||||
# 文档的开关
|
# 文档的开关
|
||||||
VUE_APP_DOC_ENABLE = false
|
VUE_APP_DOC_ENABLE = false
|
||||||
|
|
||||||
# 百度统计
|
|
||||||
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab
|
|
||||||
|
|||||||
@@ -18,5 +18,3 @@ VUE_APP_TENANT_ENABLE = true
|
|||||||
# 文档的开关
|
# 文档的开关
|
||||||
VUE_APP_DOC_ENABLE = false
|
VUE_APP_DOC_ENABLE = false
|
||||||
|
|
||||||
# 百度统计
|
|
||||||
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
FROM nginx
|
||||||
|
COPY ./dist /usr/share/nginx/html
|
||||||
|
COPY ./conf.d/default.conf /etc/nginx/conf.d/
|
||||||
|
EXPOSE 80/tcp
|
||||||
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
gzip_static on;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
gzip_static on;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /admin-api/ {
|
||||||
|
proxy_pass http://127.0.0.1:48080/;
|
||||||
|
}
|
||||||
|
|
||||||
|
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# proxy_pass http://127.0.0.1;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# root html;
|
||||||
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
|
# fastcgi_index index.php;
|
||||||
|
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||||
|
# include fastcgi_params;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# deny access to .htaccess files, if Apache's document root
|
||||||
|
# concurs with nginx's one
|
||||||
|
#
|
||||||
|
#location ~ /\.ht {
|
||||||
|
# deny all;
|
||||||
|
#}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```
|
||||||
|
前置:安装docker 并运行起来,不一定要在本地运行镜像,但是要在本地打包docker, 平时如果电脑太卡了。可以检查一下是不是用docker镜像在运行把他们全部关闭掉。
|
||||||
|
docker ps ,可以查看哪些镜像在运行
|
||||||
|
docker stop ID
|
||||||
|
```
|
||||||
|
|
||||||
|
###
|
||||||
|
1. 在vue根目录运行npm run build 打包发布包,配置打包到docker/dist目录下
|
||||||
|
|
||||||
|
###
|
||||||
|
2. cd到这个目录,运行 docker build -t zyh8419792/yudao-ui-admin . 注意后面有一个. zyh8419792是我的账户名可以改成自己的,yudao-ui-admin是我定的也可以随便改。
|
||||||
|
###
|
||||||
|
3. 运行docker push zyh8419792/yudao-ui-admin,当然这一部之前是需要先登录docker账号(docker login),如果要推送到我的仓库,需要我授权。 默认就是推送latest了
|
||||||
|
###
|
||||||
|
4. 推送完成后,进入rainbond,新建组件,选镜像构建,docker.io/zyh8419792/yudao-ui-admin,由于是nginx开启的转发,记得把服务端拉进前端的依赖
|
||||||
|
|
||||||
+8
-12
@@ -21,7 +21,7 @@ module.exports = {
|
|||||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
publicPath: process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '/',
|
publicPath: process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '/',
|
||||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||||
outputDir: 'dist',
|
outputDir: 'docker/dist',
|
||||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||||
assetsDir: 'static',
|
assetsDir: 'static',
|
||||||
// 是否开启eslint保存检测,有效值:ture | false | 'error'
|
// 是否开启eslint保存检测,有效值:ture | false | 'error'
|
||||||
@@ -77,12 +77,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
||||||
// new CompressionPlugin({
|
new CompressionPlugin({
|
||||||
// test: /\.(js|css|html)?$/i, // 压缩文件格式
|
test: /\.(js|css|html)?$/i, // 压缩文件格式
|
||||||
// filename: '[path].gz[query]', // 压缩后的文件名
|
filename: '[path].gz[query]', // 压缩后的文件名
|
||||||
// algorithm: 'gzip', // 使用gzip压缩
|
algorithm: 'gzip', // 使用gzip压缩
|
||||||
// minRatio: 0.8 // 压缩率小于1才会压缩
|
minRatio: 0.8, // 压缩率小于1才会压缩
|
||||||
// })
|
deleteOriginalAssets:true
|
||||||
|
})
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
@@ -139,11 +140,6 @@ module.exports = {
|
|||||||
}])
|
}])
|
||||||
.end()
|
.end()
|
||||||
|
|
||||||
config.plugin('compressionPlugin').use(new CompressionPlugin({
|
|
||||||
test: /\.(js|css|less)$/, // 匹配文件名
|
|
||||||
threshold: 10240, // 对超过10k的数据压缩
|
|
||||||
deleteOriginalAssets: true // 删除源文件
|
|
||||||
}))
|
|
||||||
|
|
||||||
config
|
config
|
||||||
.optimization.splitChunks({
|
.optimization.splitChunks({
|
||||||
|
|||||||
Reference in New Issue
Block a user