This commit is contained in:
parent
445c6eb8f6
commit
c2b412dc4c
|
|
@ -1,9 +1,11 @@
|
|||
node_modules
|
||||
.next
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
.git
|
||||
.gitignore
|
||||
apps/api
|
||||
apps/migrant
|
||||
apps/staffai
|
||||
build
|
||||
nginx
|
||||
admin-v5
|
||||
test
|
||||
README.md
|
||||
*.log
|
||||
*.md
|
||||
test/
|
||||
tmp/
|
||||
|
|
|
|||
|
|
@ -11,15 +11,21 @@
|
|||
RUN npm install -g pnpm
|
||||
|
||||
# 复制依赖声明文件
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
|
||||
|
||||
# 安装所有依赖(包括开发依赖)
|
||||
# 安装根目录依赖
|
||||
RUN pnpm install
|
||||
|
||||
# 复制项目源码(注意 .dockerignore 应该屏蔽 node_modules 等无关内容)
|
||||
COPY . .
|
||||
# 只复制子项目 blogai 和必要源码
|
||||
COPY apps/blogai ./apps/blogai
|
||||
COPY packages ./packages
|
||||
COPY internal ./internal
|
||||
COPY tools ./tools
|
||||
COPY index.html ./index.html
|
||||
COPY openapi.json ./openapi.json
|
||||
COPY tsconfig.json ./tsconfig.json
|
||||
|
||||
# 编译 Next.js 应用
|
||||
# 编译子项目 apps/blogai
|
||||
RUN pnpm turbo run build --filter=apps/blogai
|
||||
|
||||
# 切换到子项目目录,单独安装生产依赖
|
||||
|
|
@ -39,15 +45,14 @@
|
|||
# 设置运行目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制生产所需文件(注意:以子项目为主)
|
||||
# 只复制子项目运行需要的文件
|
||||
COPY --from=builder /app/apps/blogai/package.json ./package.json
|
||||
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||
COPY --from=builder /app/apps/blogai/node_modules ./node_modules
|
||||
COPY --from=builder /app/apps/blogai/.next ./.next
|
||||
COPY --from=builder /app/apps/blogai/public ./public
|
||||
COPY --from=builder /app/apps/blogai/next.config.js ./next.config.js
|
||||
|
||||
# 清理无用缓存,减小镜像体积
|
||||
# 清理无用缓存,减小体积
|
||||
RUN rm -rf /root/.npm /root/.pnpm-store /tmp/*
|
||||
|
||||
# 暴露端口
|
||||
|
|
|
|||
Loading…
Reference in New Issue