fix: 修改image

This commit is contained in:
ilhamtahir committed 2024-11-17 15:05:46 +08:00
1 parent a2d53b65b3
commit 8151858e3d
1 file changed
+6 -5
+6 -5
View File
@@ -1,9 +1,8 @@
# Stage 1: Build Stage # Stage 1: Build Stage
FROM node:20 AS builder FROM node:20 AS builder
# Set npm registry to Tencent Cloud # Install pnpm globally
RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ \ RUN npm install -g pnpm@latest
&& npm install -g pnpm@latest
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /usr/src/app 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 and pnpm-lock.yaml to the working directory
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
# Install all dependencies (including dev dependencies) # Install all dependencies
RUN pnpm install RUN pnpm install
# Copy the rest of the application files # Copy the rest of the application files
@@ -26,8 +25,10 @@ FROM node:20-alpine AS production
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /usr/src/app 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/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 the application port
EXPOSE 3000 EXPOSE 3000