paper-ai-release-24-07-21/Dockerfile
2024-02-11 14:28:03 +08:00

38 lines
828 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.

# 使用 Node.js 官方镜像作为构建环境
FROM node:alpine as builder
# 设置工作目录
WORKDIR /app
# 复制 package.json 和 package-lock.json (或 yarn.lock)
COPY package*.json ./
# 如果使用yarn并有yarn.lock文件也可以复制
# COPY package.json yarn.lock ./
# 安装项目依赖
RUN npm install
# 如果使用 yarn可以用 RUN yarn install 代替
# 复制项目文件到工作目录
COPY . .
# 构建应用
RUN npm run build
# 使用 Node.js 镜像运行应用
FROM node:alpine
# 设置工作目录
WORKDIR /app
# 只复制构建产出和package.json到新的镜像中
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# 暴露端口
EXPOSE 3000
# 启动 Next.js 应用
CMD ["npm", "start"]