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"]