Skip to content

Commit

Permalink
优化docker打包镜像文件过大的问题 (Chanzhaoyu#415)
Browse files Browse the repository at this point in the history
* chore: 更新文档

* Improve zh-TW locale (Chanzhaoyu#379)

* fix: 移动端样式

* feat: typo

* fix: 调整滚动回原样

* ⚡优化docker打包镜像文件过大

---------

Co-authored-by: ChenZhaoYu <[email protected]>
Co-authored-by: Peter Dave Hello <[email protected]>
  • Loading branch information
3 people authored and jingChen55 committed Mar 27, 2023
1 parent 574a8fe commit a1ae55c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/node_modules
*/node_modules
node_modules
Dockerfile
.git
.husky
.github
.vscode
.*
*/.*
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ FROM node:lts-alpine AS builder
COPY ./ /app
WORKDIR /app

RUN npm install pnpm -g && pnpm install && pnpm run build
RUN apk add --no-cache git \
&& npm install pnpm -g \
&& pnpm install \
&& pnpm run build \
&& rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*

# service
FROM node:lts-alpine
Expand All @@ -13,8 +17,12 @@ COPY /service /app
COPY --from=builder /app/dist /app/public

WORKDIR /app
RUN npm install pnpm -g && pnpm install
RUN apk add --no-cache git \
&& npm install pnpm -g \
&& pnpm install --only=production \
&& rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*


EXPOSE 3002

CMD ["pnpm", "run", "start"]
CMD ["pnpm", "run", "start"]

0 comments on commit a1ae55c

Please sign in to comment.