Skip to content

Commit e2aeb98

Browse files
committed
refactor(scripts):配置文件修改
- nginx 端口自定义 - 构建步骤简化 - 提供页面部署脚本
1 parent 7809246 commit e2aeb98

File tree

3 files changed

+59
-12
lines changed

3 files changed

+59
-12
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:latest
1717
# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面 注意:--from参数
1818
COPY --from=build_base /apps/docs/.vuepress/dist/ /usr/share/nginx/html/
1919

20-
## 暴露端口
21-
EXPOSE 80
20+
COPY nginx.conf /etc/nginx/
21+
EXPOSE 7100
22+
CMD ["nginx", "-g", "daemon off;"]

nginx.conf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# 参考:https://www.likecs.com/ask-1256888.html
2+
user root;
3+
worker_processes auto;
4+
error_log /var/log/nginx/error.log warn;
5+
events {
6+
worker_connections 1024;
7+
}
8+
http {
9+
include /etc/nginx/mime.types;
10+
default_type application/octet-stream;
11+
sendfile off;
12+
access_log off;
13+
keepalive_timeout 3000;
14+
server {
15+
listen 7100;
16+
server_name localhost;
17+
#charset koi8-r;
18+
access_log /var/log/nginx/access.log main;
19+
error_log /var/log/nginx/error.log error;
20+
## 静态资源代理
21+
location / {
22+
gzip on; #开启或关闭gzip on off
23+
gzip_disable "msie6"; #不使用gzip IE6
24+
gzip_min_length 100k; #gzip压缩最小文件大小,超出进行压缩(自行调节)
25+
gzip_buffers 4 16k; #buffer 不用修改
26+
gzip_comp_level 8; #压缩级别:1-10,数字越大压缩的越好,时间也越长
27+
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; # 压缩文件类型
28+
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
29+
root /usr/share/nginx/html;
30+
index index.html index.htm;
31+
# 如果vue-router使用的是history模式,需要设置这个
32+
try_files $uri $uri/ /index.html;
33+
}
34+
## 错误页面
35+
error_page 404 /404.html;
36+
error_page 500 502 503 504 /50x.html;
37+
location = /50x.html {
38+
root /usr/share/nginx/html;
39+
}
40+
}
41+
}
42+

deploy.sh renamed to scripts/page_deploy.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,36 @@
99
# @LastEditTime: 2022-04-18 23:35:15
1010
###
1111

12-
# abort on errors
12+
commitInfo=${1}
13+
1314
set -e
1415

15-
# build
16+
# 进入上级目录,并编译
1617
npm run build
1718

18-
# navigate into the build output directory
19+
## 切换到dist文件目录
1920
cd docs/.vuepress/dist
2021

21-
# if you are deploying to a custom domain
22-
# echo 'www.example.com' > CNAME
23-
2422
git init
2523
git add -A
26-
git commit -m 'JavaScriptCollection Init'
24+
25+
## 如果没有输入commit信息,则采用默认
26+
if [ "${commitInfo}" -eq "" ]; then
27+
commitInfo="JavaScriptCollection Init"
28+
fi
29+
30+
git commit -m "refactor:${commitInfo}"
2731

2832

2933
## 配置个人信息
30-
git config user.name "mmdapl"
31-
git config user.email "fairy@2925.com"
34+
git config user.name "喜欢吃芝士葡萄的妹妹"
35+
git config user.email "fairy0115@2925.com"
3236

3337
# if you are deploying to https://<USERNAME>.github.io
3438
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
3539

3640
# if you are deploying to https://<USERNAME>.github.io/<REPO>
37-
git push -f https://github.com/mmdapl/JavaScriptCollection.git master:gh-pages
41+
git push -f https://github.com/mmdapl/JavaScriptCollection.git master:pages/github
3842

3943

4044
cd -

0 commit comments

Comments
 (0)