From a1ae55cc096fb08b0bfaf0b217559e201b5ad59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A3=B3=E5=A3=B3=E4=B8=AD=E7=9A=84=E5=AE=87=E5=AE=99?= Date: Thu, 9 Mar 2023 17:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96docker=E6=89=93=E5=8C=85?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=96=87=E4=BB=B6=E8=BF=87=E5=A4=A7=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#415)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 更新文档 * Improve zh-TW locale (#379) * fix: 移动端样式 * feat: typo * fix: 调整滚动回原样 * :zap:优化docker打包镜像文件过大 --------- Co-authored-by: ChenZhaoYu <790348264@qq.com> Co-authored-by: Peter Dave Hello --- .dockerignore | 8 ++++---- Dockerfile | 14 +++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 5078fcdfc6..def59e5e78 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ +**/node_modules +*/node_modules node_modules Dockerfile -.git -.husky -.github -.vscode +.* +*/.* diff --git a/Dockerfile b/Dockerfile index f0b6f22821..90a0f09344 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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"] \ No newline at end of file +CMD ["pnpm", "run", "start"]