2024-01-23 21:45:25 +08:00
|
|
|
|
# 编译阶段
|
2024-04-22 13:55:54 +08:00
|
|
|
|
FROM node:18-alpine AS base
|
|
|
|
|
FROM base AS build
|
2024-01-23 21:45:25 +08:00
|
|
|
|
WORKDIR /app
|
2024-04-22 13:55:54 +08:00
|
|
|
|
COPY package.json ./
|
2024-01-23 21:45:25 +08:00
|
|
|
|
|
2024-04-20 22:15:08 +08:00
|
|
|
|
# 使用腾讯源(国内服务器可取消下方注释以提升安装速度)
|
|
|
|
|
# RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
|
|
|
|
|
|
2024-04-21 08:23:07 +08:00
|
|
|
|
# 如遇到提示网站证书无效,取消下方注释,禁止严格SS策略
|
|
|
|
|
# RUN npm config set strict-ssl false
|
|
|
|
|
|
2024-05-21 19:32:36 +08:00
|
|
|
|
# 使用淘宝源安装项目依赖(国内用户居多)
|
|
|
|
|
RUN npm config set registry https://registry.npmmirror.com && \
|
|
|
|
|
npm install --omit=dev
|
2024-04-22 13:55:54 +08:00
|
|
|
|
|
2024-01-23 21:45:25 +08:00
|
|
|
|
|
|
|
|
|
# 运行阶段
|
2024-04-22 13:55:54 +08:00
|
|
|
|
FROM base AS runner
|
2024-01-23 21:45:25 +08:00
|
|
|
|
ENV TZ="Asia/Shanghai"
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
2024-04-22 13:55:54 +08:00
|
|
|
|
|
|
|
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
|
|
|
COPY . .
|
|
|
|
|
|
2024-01-23 21:45:25 +08:00
|
|
|
|
EXPOSE 9520
|
|
|
|
|
|
|
|
|
|
CMD ["node", "./dist/main.js"]
|