Skip to content

Commit

Permalink
chore: transform to pnpm workspace, refine tsconfig, update dev docs #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mereithhh committed Mar 10, 2023
1 parent 85439df commit 1d9b9db
Show file tree
Hide file tree
Showing 14 changed files with 4,989 additions and 528 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
auto-install-peers=true
network-timeout=600000
42 changes: 23 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,32 @@ ENV NODE_OPTIONS='--max_old_space_size=4096 --openssl-legacy-provider'
ENV EEE=production
WORKDIR /app
USER root
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
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 npm install --global pnpm
RUN pnpm config set network-timeout 600000
RUN pnpm i
# RUN sed -i 's/\/assets/\/admin\/assets/g' dist/admin/index.html
RUN yarn build
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
RUN npm install --global pnpm
RUN pnpm config set network-timeout 600000
RUN pnpm i
RUN pnpm build

FROM node:16-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/website/package.json ./packages/website/pnpm-lock.yaml* ./
RUN npm install --global pnpm
RUN pnpm config set network-timeout 600000 -g
# RUN yarn config set registry https://registry.npmmirror.com -g
RUN yarn
RUN pnpm i

FROM node:16-alpine AS WEBSITE_BUILDER
WORKDIR /app
Expand All @@ -40,35 +42,37 @@ 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 --global pnpm
RUN pnpm config set network-timeout 60000 -g
RUN pnpm config set registry https://registry.npmmirror.com -g
RUN pnpm build


#运行容器
FROM node:alpine AS RUNNER
FROM node:18-alpine AS RUNNER
WORKDIR /app
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 --global pnpm
RUN pnpm config set network-timeout 600000
# 安装 waline
WORKDIR /app/waline
COPY ./packages/waline/ ./
RUN yarn && yarn cache clean
RUN pnpm i
# 复制 server
WORKDIR /app/server
COPY --from=SERVER_BUILDER /app/node_modules ./node_modules
COPY --from=SERVER_BUILDER /app/dist ./
COPY --from=SERVER_BUILDER /app/dist/ ./
# 复制 website
WORKDIR /app/website
COPY --from=WEBSITE_BUILDER /app/next.config.js ./
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 && 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ curl -L https://vanblog.mereith.com/vanblog.sh -o vanblog.sh && chmod +x vanblog
- [ ] 快捷分享按钮
- [x] 完善可自定义上传文件的自定义页面功能(现在的自定义页面有潜在的 css 污染问题)
- [x] 图片上传自动添加水印
- [x] 迁移到 pnpm,使用 workspace
- [ ] 增加在特定事件后触发执行自定义代码或 webhook 的扩展能力
- [ ] 插件系统
- [ ] 自定义主题(前端渲染器)系统
Expand Down
4 changes: 4 additions & 0 deletions docs/assets/vanblog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1d9b9db

Please sign in to comment.