feat: 增加部署脚本

This commit is contained in:
tangtaoit 2023-06-27 11:04:30 +08:00
parent 23aa39a9e2
commit 01af5510dd
5 changed files with 44 additions and 1 deletions

View File

@ -10,6 +10,7 @@ export default defineConfig({
title: "悟空IM",
description: "IM",
lang: "zh-CN",
ignoreDeadLinks: true,
head: [
["meta", { name: "keywords", content: "IM" }],
["link", { rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
@ -48,7 +49,7 @@ export default defineConfig({
{ icon: 'github', link: 'https://github.com/WuKongIM/WuKongIM' }
],
footer: {
message: `本文档内容版权属于 悟空IM 作者,保留所有权利`,
message: `本文档内容版权属于 上海信必达网络科技有限公司,保留所有权利`,
copyright: "Copyright © 2023 | Powered by 悟空IM | ICP备案号沪ICP备2021032718号-2",
},
search: {

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM node:18.0.0 as builder
WORKDIR /app
RUN curl -o- -L https://yarnpkg.com/install.sh | bash
COPY package.json .
COPY yarn.lock .
# https://registry.npmjs.org/ https://registry.npm.taobao.org
# RUN yarn config set registry https://registry.npm.taobao.org -g
# RUN yarn config set disturl https://npm.taobao.org/dist
RUN yarn install
COPY . .
RUN yarn build
FROM nginx:latest
COPY --from=builder /app/docker-entrypoint.sh /docker-entrypoint2.sh
COPY --from=builder /app/nginx.conf.template /
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
ENTRYPOINT ["sh", "/docker-entrypoint2.sh"]
CMD ["nginx","-g","daemon off;"]

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
build:
docker build -t wukongimdocs .
deploy:
docker build -t wukongimdocs .
docker tag wukongimdocs wukongim/wukongimdocs:latest
docker push wukongim/wukongimdocs:latest

8
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -eu
envsubst '${API_URL}' < /nginx.conf.template > /etc/nginx/conf.d/default.conf
exec "$@"

10
nginx.conf.template Normal file
View File

@ -0,0 +1,10 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}