fix: 打包脚本修改

This commit is contained in:
ilhamtahir committed 2024-11-17 15:46:14 +08:00
1 parent 4742e2013d
commit 163392d9d4
1 file changed
+13 -7
+13 -7
View File
@@ -1,9 +1,9 @@
# Stage 1: Build Stage
FROM node:20 AS builder
FROM node:22 AS builder
# Set npm registry to Tencent Cloud
# Set npm registry to Tencent Cloud and install pnpm globally
RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ \
&& npm install -g pnpm@latest
&& npm install -g pnpm@latest
# Set the working directory inside the container
WORKDIR /usr/src/app
@@ -21,15 +21,21 @@ COPY . .
RUN pnpm run build
# Stage 2: Production Stage
FROM node:20-alpine AS production
FROM node:22 AS production
# Set npm registry to Tencent Cloud and install pnpm globally
RUN npm install -g pnpm@latest
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy the build output and dependencies from the build stage
# Copy the build output and production dependencies 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
COPY --from=builder /usr/src/app/package.json /usr/src/app/pnpm-lock.yaml ./
# Install only production dependencies
RUN pnpm config set registry https://mirrors.cloud.tencent.com/npm/ \
&& pnpm install --prod
# Expose the application port
EXPOSE 3000