Illuminix_nextjs/Dockerfile
2024-10-29 17:32:09 +08:00

29 lines
581 B
Docker
Raw Permalink 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.

# 使用指定的 Node.js 版本作为基础镜像
FROM node:20.15.1
RUN npm config set registry https://registry.npmmirror.com
# 全局安装 pm2 进程管理器
RUN npm install pm2 -g
# 设置工作目录
WORKDIR /app
# 复制 package.json 和 package-lock.json如果有到工作目录
COPY package*.json ./
# 安装依赖
RUN npm install
# 复制项目的所有文件到工作目录
COPY . .
# 构建 Next.js 项目
RUN npm run build
# 暴露应用运行的端口
EXPOSE 12680
# 使用 pm2 启动 Next.js 服务
CMD ["pm2-runtime", "start", "npm", "--", "start"]