2024-08-12 10:55:25 +08:00
|
|
|
# 使用官方Node.js镜像作为基础镜像
|
|
|
|
FROM node:18-alpine
|
2024-08-08 13:29:13 +08:00
|
|
|
|
2024-08-09 15:08:29 +08:00
|
|
|
# 设置工作目录
|
2024-08-08 13:29:13 +08:00
|
|
|
WORKDIR /app
|
|
|
|
|
2024-08-12 10:55:25 +08:00
|
|
|
# 复制package.json和package-lock.json
|
2024-08-09 15:08:29 +08:00
|
|
|
COPY package*.json ./
|
2024-08-08 13:29:13 +08:00
|
|
|
|
2024-08-09 15:08:29 +08:00
|
|
|
# 安装依赖
|
|
|
|
RUN npm install
|
|
|
|
|
2024-08-12 10:55:25 +08:00
|
|
|
# 复制项目文件
|
2024-08-08 13:29:13 +08:00
|
|
|
COPY . .
|
|
|
|
|
2024-08-09 15:08:29 +08:00
|
|
|
# 暴露服务端口
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2024-08-12 10:55:25 +08:00
|
|
|
# 启动服务
|
|
|
|
CMD ["node", "index.js"]
|