|
@@ -1,8 +1,9 @@
|
|
|
# Stage 1: Build Stage
|
|
# Stage 1: Build Stage
|
|
|
FROM node:20 AS builder
|
|
FROM node:20 AS builder
|
|
|
|
|
|
|
|
-# Install pnpm globally
|
|
|
|
|
-RUN npm install -g pnpm@latest
|
|
|
|
|
|
|
+# Set npm registry to Tencent Cloud
|
|
|
|
|
+RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ \
|
|
|
|
|
+ && 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
|
|
@@ -10,7 +11,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
|
|
|
|
|
|
|
+# Install all dependencies (including dev dependencies)
|
|
|
RUN pnpm install
|
|
RUN pnpm install
|
|
|
|
|
|
|
|
# Copy the rest of the application files
|
|
# Copy the rest of the application files
|
|
@@ -25,7 +26,7 @@ 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 necessary files from the build stage
|
|
|
|
|
|
|
+# Copy the build output and dependencies 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/node_modules ./node_modules
|
|
|
COPY --from=builder /usr/src/app/package.json ./package.json
|
|
COPY --from=builder /usr/src/app/package.json ./package.json
|