|
@@ -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
|
|
|
|
|
-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
|
|
# 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
|