Skip to content

Commit

Permalink
Merge pull request #19 from devsapp/dumi
Browse files Browse the repository at this point in the history
Bump docusarurus and dumi version
  • Loading branch information
loganhz authored May 20, 2024
2 parents edff684 + b37a789 commit fa3a3ba
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docusaurus/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Project
Name: website-docusaurus-v3
Provider:
- 阿里云
Version: 0.0.10
Version: 0.0.11
Description: 本案例将 Docusaurus ,这一使用者广泛的网站生成器,快速创建并部署到阿里云函数计算 FC 。
HomePage: https://github.com/devsapp/start-website
Organization: 阿里云函数计算(FC)
Expand Down
32 changes: 32 additions & 0 deletions docusaurus/src/code/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# nginx -c /code/nginx.conf -g 'daemon off;'

events { worker_connections 1024; }
http {
server {
error_log /dev/stderr;
access_log /dev/stdout;

gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/html text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/svg+xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
include /etc/nginx/mime.types;
add_header Access-Control-Allow-Origin *;

listen 9000;

location / {
root /code;
index index.html;
add_header Cache-Control "max-age=0";
try_files $uri $uri/ /index.html =404;
}

location ~ ^/.(images|javascript|js|css|flash|media|static)/ {
root /code;
}

}
}
35 changes: 20 additions & 15 deletions docusaurus/src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,34 @@ access: "{{ access }}"

vars: # 全局变量
region: "{{ region }}"
functionName: "{{ functionName }}"

resources:
docusaurus-site:
framework:
component: fc3
actions:
pre-deploy:
# 当修改初始项目后,执行下列命令进行代码产物构建
- run: export PATH=/usr/local/versions/node/v18.14.2/bin:$PATH && npm install && npm run build && rm -rf node_modules
- run: export PATH=/usr/local/versions/node/v20.8.1/bin:$PATH && npm install
path: ./code
- run: export PATH=/usr/local/versions/node/v20.8.1/bin:$PATH && npm run build
path: ./code
- run: cp nginx.conf ./code/build/nginx.conf
path: ./code
# - run: rm -rf node_modules
# path: ./code
- plugin: website-plugin-v3
args:
port: 80 # 监听端口, http 为 80, https 为 443
dist: /code/build # build 后生成的代码目录, 绝对路径
props:
region: ${vars.region}
functionName: ${vars.functionName}
functionName: "{{ functionName }}"
description: "Serverless Devs Docusaurus Site."
timeout: 30
memorySize: 512
code: ./code
timeout: 60
memorySize: 1024
instanceConcurrency: 100
customRuntimeConfig:
command:
- nginx
- "-c"
- "/code/nginx.conf"
- "-g"
- "daemon off;"
port: 9000
code: ./code/build
runtime: custom.debian10
fc3_domain_0:
component: fc3-domain
Expand All @@ -51,4 +56,4 @@ resources:
routeConfig:
routes:
- path: /*
functionName: ${vars.functionName}
functionName: ${resources.framework.props.functionName}
3 changes: 1 addition & 2 deletions dumi/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Edition: 3.0.0
Type: Project
Name: website-dumi-v3
Version: 0.0.7
Version: 0.0.8
Provider:
- 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
Description: 本案例将 Dumi ,这一为 React 组件和库的开发者量身打造的文档生成器,快速创建并部署到阿里云函数计算 FC 。
Expand Down Expand Up @@ -53,4 +53,3 @@ Parameters:
type: string
default: dumi-${default-suffix}
description: 应用的函数名称

32 changes: 32 additions & 0 deletions dumi/src/code/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# nginx -c /code/nginx.conf -g 'daemon off;'

events { worker_connections 1024; }
http {
server {
error_log /dev/stderr;
access_log /dev/stdout;

gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/html text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/svg+xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
include /etc/nginx/mime.types;
add_header Access-Control-Allow-Origin *;

listen 9000;

location / {
root /code;
index index.html;
add_header Cache-Control "max-age=0";
try_files $uri $uri/ /index.html =404;
}

location ~ ^/.(images|javascript|js|css|flash|media|static)/ {
root /code;
}

}
}
35 changes: 20 additions & 15 deletions dumi/src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,34 @@ access: "{{ access }}"

vars: # 全局变量
region: "{{ region }}"
functionName: "{{ functionName }}"

resources:
nginx-server:
framework:
component: fc3
actions:
pre-deploy:
# 当修改初始项目后,执行下列命令进行代码产物构建
- run: export PATH=/usr/local/versions/node/v18.14.2/bin:$PATH && npm install && npm run build && rm -rf node_modules
- run: export PATH=/usr/local/versions/node/v20.8.1/bin:$PATH && npm install
path: ./code
- run: export PATH=/usr/local/versions/node/v20.8.1/bin:$PATH && npm run build
path: ./code
- run: cp nginx.conf ./code/dist/nginx.conf
path: ./code
# - run: rm -rf node_modules
# path: ./code
- plugin: website-plugin-v3 # 这里引入的是相对路径,正式配置替换成你自己的component名称即可
args:
port: 80 # 监听端口, http 为 80, https 为 443
dist: /code/dist # build 后生成的代码目录, 以根目录文件夹名称作为绝对路径
props:
region: ${vars.region}
functionName: ${vars.functionName}
functionName: "{{ functionName }}"
description: "Serverless Devs Dumi Site."
timeout: 30
memorySize: 512
code: ./code
timeout: 60
memorySize: 1024
instanceConcurrency: 100
customRuntimeConfig:
command:
- nginx
- "-c"
- "/code/nginx.conf"
- "-g"
- "daemon off;"
port: 9000
code: ./code/dist
runtime: custom.debian10

fc3_domain_0:
Expand All @@ -52,4 +57,4 @@ resources:
routeConfig:
routes:
- path: /*
functionName: ${vars.functionName}
functionName: ${resources.framework.props.functionName}

0 comments on commit fa3a3ba

Please sign in to comment.