前端修饰与渲染处理
This commit is contained in:
@@ -3,12 +3,19 @@ FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
# Copy package files and npm config
|
||||
COPY server/package*.json ./server/
|
||||
COPY server/.npmrc ./server/
|
||||
COPY shared/package*.json ./shared/
|
||||
|
||||
# Install dependencies
|
||||
RUN cd server && npm ci
|
||||
# Install dependencies with multiple mirror fallback
|
||||
RUN cd server && \
|
||||
echo "Trying Aliyun mirror..." && \
|
||||
npm install --registry=https://registry.npmmirror.com --prefer-offline --no-audit --no-fund || \
|
||||
(echo "Aliyun failed, trying Tencent Cloud..." && \
|
||||
npm install --registry=https://mirrors.cloud.tencent.com/npm/ --prefer-offline --no-audit --no-fund) || \
|
||||
(echo "Tencent failed, trying Huawei Cloud..." && \
|
||||
npm install --registry=https://repo.huaweicloud.com/repository/npm/ --prefer-offline --no-audit --no-fund)
|
||||
|
||||
# Copy source code
|
||||
COPY server/src ./server/src
|
||||
@@ -24,9 +31,15 @@ FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install production dependencies
|
||||
# Copy package files and npm config
|
||||
COPY server/package*.json ./
|
||||
RUN npm ci --only=production
|
||||
COPY server/.npmrc ./
|
||||
|
||||
# Install production dependencies with multiple mirror fallback
|
||||
RUN echo "Installing production dependencies..." && \
|
||||
(npm install --omit=dev --registry=https://registry.npmmirror.com --prefer-offline --no-audit --no-fund || \
|
||||
npm install --omit=dev --registry=https://mirrors.cloud.tencent.com/npm/ --prefer-offline --no-audit --no-fund || \
|
||||
npm install --omit=dev --registry=https://repo.huaweicloud.com/repository/npm/ --prefer-offline --no-audit --no-fund)
|
||||
|
||||
# Copy built application
|
||||
COPY --from=builder /app/server/dist ./dist
|
||||
|
||||
Reference in New Issue
Block a user