File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11# 使用轻量级 Node.js 镜像
22FROM node:18-alpine
33
4- RUN apt-get update
5- RUN apt-get install -y openssl
4+ # 使用 apk 包管理器来安装 openssl
5+ RUN apk update && apk add --no-cache openssl
66
77RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
8+
89# 设置工作目录
910WORKDIR /home/node/app
1011
12+ # 复制 package.json 和 yarn.lock 文件
1113COPY package.json yarn.lock ./
1214
13- USER node
1415
1516# 安装所有依赖
1617RUN yarn install
1718
1819# 复制所有应用代码
1920COPY . .
21+
2022# 生成 Prisma 客户端
2123RUN npx prisma generate
22- # 打包应用
24+
25+ # 构建应用(如果有构建步骤)
2326RUN yarn build
2427
2528# 暴露应用端口
2629EXPOSE 3000
2730
2831# 启动应用,首先运行数据库迁移命令
29- CMD ["sh", "-c", "npx prisma migrate deploy && npx prisma db seed && npm start"]
32+ CMD ["sh", "-c", "npx prisma migrate deploy && npx prisma db seed && npm start"]
You can’t perform that action at this time.
0 commit comments