monitor-ai/Dockerfile

29 lines
660 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# monitor-ai Dockerfile
FROM node:22-alpine AS base
WORKDIR /app
# 1. 依赖安装
COPY package.json package-lock.json ./
RUN npm ci --production=false
# 2. 复制共享库(构建前由部署脚本创建 symlink: shared -> ../shared
COPY shared/ ./shared/
# 3. 复制源码并构建
COPY . .
RUN npm run build
# 4. 生产镜像
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=base /app/.next/standalone ./
COPY --from=base /app/.next/static ./.next/static
COPY --from=base /app/scripts ./scripts
COPY --from=base /app/shared ./shared
COPY entrypoint.sh ./
RUN npm install -g tsx
EXPOSE 6181
CMD ["sh", "entrypoint.sh"]