Files
record-app-next/dockerfile

30 lines
529 B
Plaintext
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.

# record-app/Dockerfile
FROM node:20
WORKDIR /app
# 复制 package.json 和 package-lock.json
COPY package*.json ./
# 安装所有依赖(包括开发依赖,因为需要 Prisma
RUN npm install
# 复制 Prisma schema
COPY prisma ./prisma
# 生成 Prisma 客户端
RUN npx prisma generate
# 复制其余文件
COPY . .
# 构建 Next.js 生产版本
RUN npm run build
# 删除开发依赖以减小镜像大小
RUN npm prune --production
# 端口可根据 next.config.js 设置
EXPOSE 3000
CMD ["npm", "run", "start"]