mirror of
https://github.com/vastxie/99AI.git
synced 2024-11-16 11:42:25 +08:00
49a72b7198
缩小体积
34 lines
821 B
Docker
34 lines
821 B
Docker
# 编译阶段
|
||
FROM node:18-alpine AS base
|
||
FROM base AS build
|
||
WORKDIR /app
|
||
COPY package.json ./
|
||
|
||
# 使用腾讯源(国内服务器可取消下方注释以提升安装速度)
|
||
# RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
|
||
|
||
# 使用淘宝源(国内服务器可取消下方注释以提升安装速度)
|
||
# RUN npm config set registry https://registry.npmmirror.com
|
||
|
||
# 如遇到提示网站证书无效,取消下方注释,禁止严格SS策略
|
||
# RUN npm config set strict-ssl false
|
||
|
||
# 安装项目依赖
|
||
RUN apk add --no-cache --virtual .build-deps git && \
|
||
npm install --omit=dev && \
|
||
apk del .build-deps
|
||
|
||
|
||
# 运行阶段
|
||
FROM base AS runner
|
||
ENV TZ="Asia/Shanghai"
|
||
|
||
WORKDIR /app
|
||
|
||
COPY --from=build /app/node_modules ./node_modules
|
||
COPY . .
|
||
|
||
EXPOSE 9520
|
||
|
||
CMD ["node", "./dist/main.js"]
|