Przeglądaj źródła

fix: 修改image

IlhamTahir 1 rok temu
rodzic
commit
8151858e3d
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6 5
      Dockerfile

+ 6 - 5
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