From 8151858e3d627a53ad3ab4241dc42dd8b3e8b5c9 Mon Sep 17 00:00:00 2001 From: IlhamTahir Date: Sun, 17 Nov 2024 15:05:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e456ee..1099a90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ # Stage 1: Build Stage FROM node:20 AS builder -# Set npm registry to Tencent Cloud -RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ \ - && npm install -g pnpm@latest +# Install pnpm globally +RUN npm install -g pnpm@latest # Set the working directory inside the container WORKDIR /usr/src/app @@ -11,7 +10,7 @@ WORKDIR /usr/src/app # Copy package.json and pnpm-lock.yaml to the working directory COPY package.json pnpm-lock.yaml ./ -# Install all dependencies (including dev dependencies) +# Install all dependencies RUN pnpm install # Copy the rest of the application files @@ -26,8 +25,10 @@ FROM node:20-alpine AS production # Set the working directory inside the container WORKDIR /usr/src/app -# Copy only the build output from the build stage +# Copy necessary files from the build stage COPY --from=builder /usr/src/app/dist ./dist +COPY --from=builder /usr/src/app/node_modules ./node_modules +COPY --from=builder /usr/src/app/package.json ./package.json # Expose the application port EXPOSE 3000