Skip to content

Commit 18e80fc

Browse files
author
lixueping
committed
fix: support private deploy
1 parent 9278cd3 commit 18e80fc

File tree

4 files changed

+64
-12
lines changed

4 files changed

+64
-12
lines changed

Dockerfile.Private

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:14.19.3 as PATH_IMAGE
2+
ENV NODE_OPTIONS=--max_old_space_size=5120
3+
WORKDIR /app
4+
COPY package.json .
5+
RUN yarn
6+
COPY . .
7+
RUN npm run docs:build-private
8+
9+
FROM nginx:alpine
10+
COPY --from=PATH_IMAGE /app/docs/.vuepress/dist /docs
11+
COPY nginx.conf /etc/nginx/conf.d/default.conf
12+
EXPOSE 80

docs/.vuepress/env.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
const fs = require('fs')
2-
const path = require('path')
1+
const fs = require('fs');
2+
const path = require('path');
33
// 加载根目录的config.yaml
44
const { cosmiconfigSync } = require('cosmiconfig');
55
// 确保config.yaml存在
6-
fs.appendFileSync(path.resolve(__dirname, '../../config.yaml'), '')
6+
fs.appendFileSync(path.resolve(__dirname, '../../config.yaml'), '');
77

88
const config = cosmiconfigSync('config', {
9-
searchPlaces: [
10-
'config.yaml',
11-
]
12-
}).search()
13-
9+
searchPlaces: ['config.yaml']
10+
}).search();
11+
console.log(process.env, '>>>>>>>>>>>>>>');
1412
module.exports = {
15-
/** 站点基础路径 */
16-
basePath: '/v3/',
17-
config: config && config.config
13+
/** 站点基础路径 */
14+
basePath: process.env.SITE_BASE_PATH || '/v3/',
15+
config: config && config.config
1816
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"postinstall": "patch-package",
77
"docs:dev": "vuepress dev docs -p 8888",
88
"docs:no-cache": "node --max_old_space_size=8192 ./node_modules/vuepress/cli.js dev docs -p 8888 --no-cache",
9-
"docs:build": "node --max_old_space_size=8192 ./node_modules/vuepress/cli.js build docs --max-concurrency=150 --no-cache"
9+
"docs:build": "node --max_old_space_size=8192 ./node_modules/vuepress/cli.js build docs --max-concurrency=150 --no-cache",
10+
"docs:build-private": "cross-env SITE_BASE_PATH=/ node --max_old_space_size=8192 ./node_modules/vuepress/cli.js build docs --max-concurrency=150 --no-cache"
1011
},
1112
"main": "index.js",
1213
"author": "Authing",
@@ -15,6 +16,7 @@
1516
"@vuepress/plugin-google-analytics": "^1.8.3",
1617
"@vuepress/plugin-medium-zoom": "^1.8.2",
1718
"async": "^3.2.4",
19+
"cross-env": "^7.0.3",
1820
"html-minifier-terser": "^7.0.0-beta.0",
1921
"patch-package": "^6.4.7",
2022
"sass-loader": "^7.3.1",

yarn.lock

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
28742874
safe-buffer "^5.0.1"
28752875
sha.js "^2.4.8"
28762876

2877+
cross-env@^7.0.3:
2878+
version "7.0.3"
2879+
resolved "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
2880+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
2881+
dependencies:
2882+
cross-spawn "^7.0.1"
2883+
28772884
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
28782885
version "6.0.5"
28792886
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz"
@@ -2885,6 +2892,15 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
28852892
shebang-command "^1.2.0"
28862893
which "^1.2.9"
28872894

2895+
cross-spawn@^7.0.1:
2896+
version "7.0.6"
2897+
resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
2898+
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
2899+
dependencies:
2900+
path-key "^3.1.0"
2901+
shebang-command "^2.0.0"
2902+
which "^2.0.1"
2903+
28882904
crypto-browserify@^3.11.0:
28892905
version "3.12.0"
28902906
resolved "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz"
@@ -6305,6 +6321,11 @@ path-key@^2.0.0, path-key@^2.0.1:
63056321
resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz"
63066322
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
63076323

6324+
path-key@^3.1.0:
6325+
version "3.1.1"
6326+
resolved "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
6327+
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
6328+
63086329
path-parse@^1.0.7:
63096330
version "1.0.7"
63106331
resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz"
@@ -7444,11 +7465,23 @@ shebang-command@^1.2.0:
74447465
dependencies:
74457466
shebang-regex "^1.0.0"
74467467

7468+
shebang-command@^2.0.0:
7469+
version "2.0.0"
7470+
resolved "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
7471+
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
7472+
dependencies:
7473+
shebang-regex "^3.0.0"
7474+
74477475
shebang-regex@^1.0.0:
74487476
version "1.0.0"
74497477
resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz"
74507478
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
74517479

7480+
shebang-regex@^3.0.0:
7481+
version "3.0.0"
7482+
resolved "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
7483+
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
7484+
74527485
side-channel@^1.0.4:
74537486
version "1.0.4"
74547487
resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz"
@@ -8728,6 +8761,13 @@ which@^1.2.9:
87288761
dependencies:
87298762
isexe "^2.0.0"
87308763

8764+
which@^2.0.1:
8765+
version "2.0.2"
8766+
resolved "https://registry.npmmirror.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
8767+
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
8768+
dependencies:
8769+
isexe "^2.0.0"
8770+
87318771
widest-line@^3.1.0:
87328772
version "3.1.0"
87338773
resolved "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz"

0 commit comments

Comments
 (0)