Skip to content

Commit

Permalink
chore: update project structure
Browse files Browse the repository at this point in the history
chore: tweaks

chore: update deps

chore(theme-default): type error

chore: restore project structure
  • Loading branch information
Mereithhh committed Mar 8, 2023
1 parent 04215f9 commit 466931d
Show file tree
Hide file tree
Showing 153 changed files with 6,814 additions and 17,899 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
# 如果你文档需要 Git 子模块,取消注释下一行
# submodules: true

- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: 展示版本
run: echo ${{ steps.get_version.outputs.VERSION }}
- name: Set up QEMU
Expand All @@ -33,22 +33,25 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: 安装 pnpm
uses: pnpm/action-setup@v2
with:
version: 7
run_install: true

- name: 设置 Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: 安装依赖
run: yarn install --frozen-lockfile
node-version: 18
cache: pnpm

- name: 构建文档
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |-
yarn run docs:build
> docs/.vuepress/dist/.nojekyll
id: image-name
run: |-
pnpm --filter=vanblog-docs docs:build
- name: 打包镜像并推送
uses: docker/build-push-action@v2
with:
Expand All @@ -60,9 +63,7 @@ jobs:
"docker.io/mereith/van-blog-website:${{ steps.get_version.outputs.VERSION }}"
- name: 部署到集群
uses: steebchen/kubectl@v2.0.0
with: # defaults to latest kubectl binary version
with:
# defaults to latest kubectl binary version
config: ${{ secrets.K8S_CONFIG_DATA }}
command: set image deployment/vanblog-doc vanblog-doc=docker.io/mereith/van-blog-website:${{ steps.get_version.outputs.VERSION }}
# - name: send Message To me
# run: |
# curl -X POST -H "Content-Type: application/json" -d '{"source":"github-ci:van-blog-doc","message":"流水线运行完毕,${{ steps.get_version.outputs.VERSION }} 已部署"}' ${{ secrets.WEBHOOK_URL }}
53 changes: 29 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,48 @@ ENV NODE_OPTIONS='--max_old_space_size=4096 --openssl-legacy-provider'
ENV EEE=production
WORKDIR /app
USER root
COPY ./packages/admin/ ./
# RUN yarn config set registry https://registry.npmmirror.com
RUN yarn config set network-timeout 600000
RUN yarn global add umi
RUN yarn
# RUN sed -i 's/\/assets/\/admin\/assets/g' dist/admin/index.html
RUN yarn build
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
COPY ./packages/@vanblog/admin ./
RUN npm install -g pnpm
RUN pnpm config set fetch-timeout 600000
# RUN pnpm setup
# RUN pnpm install --g umi
RUN pnpm i
RUN pnpm build

FROM node:18 as SERVER_BUILDER
ENV NODE_OPTIONS=--max_old_space_size=4096
WORKDIR /app
COPY ./packages/server/ .
RUN yarn config set network-timeout 600000
RUN yarn
RUN yarn build
COPY ./packages/@vanblog/server .
RUN npm install -g pnpm
RUN pnpm config set fetch-timeout 600000
RUN pnpm i
RUN pnpm build

FROM node:16-alpine AS WEBSITE_DEPS
FROM node:18-alpine AS WEBSITE_DEPS
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
# RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY ./packages/website/package.json ./packages/website/yarn.lock* ./packages/website/package-lock.json* ./packages/website/pnpm-lock.yaml* ./
RUN yarn config set network-timeout 60000 -g
COPY ./packages/@vanblog/theme-default/package.json ./packages/@vanblog/theme-default/pnpm-lock.yaml* ./
RUN npm install -g pnpm
RUN pnpm config set fetch-timeout 600000 -g
# RUN yarn config set registry https://registry.npmmirror.com -g
RUN yarn
RUN pnpm install

FROM node:16-alpine AS WEBSITE_BUILDER
FROM node:18-alpine AS WEBSITE_BUILDER
WORKDIR /app
COPY --from=WEBSITE_DEPS /app/node_modules ./node_modules
COPY ./packages/website/ .
COPY ./packages/@vanblog/theme-default/ .
ENV isBuild=t
ENV VAN_BLOG_ALLOW_DOMAINS "pic.mereith.com"
ARG VAN_BLOG_BUILD_SERVER
ENV VAN_BLOG_SERVER_URL ${VAN_BLOG_BUILD_SERVER}
ARG VAN_BLOG_VERSIONS
ENV VAN_BLOG_VERSION ${VAN_BLOG_VERSIONS}
RUN yarn config set network-timeout 60000 -g
RUN yarn config set registry https://registry.npmmirror.com -g
RUN yarn build
RUN npm install -g pnpm
RUN pnpm config set fetch-timeout 600000 -g
RUN pnpm config set registry https://registry.npmmirror.com -g
RUN pnpm build


#运行容器
Expand All @@ -52,11 +56,12 @@ RUN apk add --no-cache --update tzdata caddy nss-tools \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
RUN yarn config set network-timeout 600000
RUN npm install -g pnpm
RUN pnpm config set fetch-timeout 600000
# 安装 waline
WORKDIR /app/waline
COPY ./packages/waline/ ./
RUN yarn && yarn cache clean
COPY ./packages/@vanblog/waline/ ./
RUN pnpm i
# 复制 server
WORKDIR /app/server
COPY --from=SERVER_BUILDER /app/node_modules ./node_modules
Expand All @@ -68,7 +73,7 @@ COPY --from=WEBSITE_BUILDER /app/public ./public
COPY --from=WEBSITE_BUILDER /app/package.json ./package.json
COPY --from=WEBSITE_BUILDER /app/.next/standalone ./
COPY --from=WEBSITE_BUILDER /app/.next/static ./.next/static
RUN cd /app/website && yarn add sharp && yarn cache clean --all && cd ..
RUN cd /app/website && pnpm add sharp && cd ..
ENV NODE_ENV production
ENV VAN_BLOG_SERVER_URL "http://127.0.0.1:3000"
ENV VAN_BLOG_ALLOW_DOMAINS "pic.mereith.com"
Expand Down
19 changes: 19 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "vanblog-docs",
"version": "0.48.0",
"private": true,
"scripts": {
"docs:build": "vuepress build docs",
"docs:clean-dev": "vuepress dev docs --clean-cache",
"docs:dev": "vuepress dev docs"
},
"devDependencies": {
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/utils": "2.0.0-beta.61",
"vue": "^3.2.47",
"vuepress": "2.0.0-beta.61",
"vuepress-plugin-redirect": "2.0.0-beta.190",
"vuepress-plugin-search-pro": "2.0.0-beta.190",
"vuepress-theme-hope": "2.0.0-beta.190"
}
}
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
"version": "0.48.0",
"private": true,
"scripts": {
"clean": "rm -rf node_modules packages/*/node_modules",
"clean": "rm -rf node_modules packages/vanblog/*/node_modules",
"build:test": "act -j test --secret-file=.env",
"dev": "lerna run dev --parallel --scope=@vanblog/server --scope=@vanblog/admin",
"dev:website": "lerna run dev --scope=@vanblog/theme-default",
"dev:admin": "lerna run dev --scope=@vanblog/admin",
"dev:server": "lerna run dev --scope=@vanblog/server",
"dev:server:noweb": "lerna run dev:noweb --scope=@vanblog/server",
"docs:build": "vuepress build docs",
"docs:clean-dev": "vuepress dev docs --clean-cache",
"docs:dev": "vuepress dev docs",
"kill": "bash scripts/kill-all.sh",
"release:local": "act -j local-build --secret-file=.env",
"release": "standard-version",
Expand All @@ -24,15 +21,17 @@
"sync-aliyun": "bash scripts/sync-aliyuncs.sh",
"webhook": "node scripts/webhook.js"
},
"packageManager": "pnpm@7.29.1",
"devDependencies": {
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/utils": "2.0.0-beta.61",
"lerna": "^6.5.1",
"standard-version": "^9.5.0",
"vue": "^3.2.47",
"vuepress": "2.0.0-beta.61",
"vuepress-plugin-redirect": "2.0.0-beta.185",
"vuepress-plugin-search-pro": "2.0.0-beta.185",
"vuepress-theme-hope": "2.0.0-beta.185"
"cross-env": "7.0.3",
"eslint": "8.35.0",
"eslint-config-prettier": "8.7.0",
"eslint-plugin-prettier": "4.2.1",
"lerna": "6.5.1",
"lint-staged": "13.1.2",
"prettier": "2.8.4",
"rimraf": "4.3.1",
"stylelint": "15.2.0",
"standard-version": "9.5.0"
}
}
18 changes: 3 additions & 15 deletions packages/admin/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
**/*.svg
package.json
.umi
.umi-production

/dist
.dockerignore
/build
/public
.DS_Store
.eslintignore
*.png
*.toml
docker
.editorconfig
Dockerfile*
.gitignore
.prettierignore
LICENSE
.eslintcache
*.lock
yarn-error.log
.history
CNAME
/build
/public
2 changes: 0 additions & 2 deletions packages/admin/.yarnrc.yml

This file was deleted.

9 changes: 0 additions & 9 deletions packages/admin/jest.config.js

This file was deleted.

Loading

0 comments on commit 466931d

Please sign in to comment.