-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_
37 lines (26 loc) · 1017 Bytes
/
_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 使用 Node.js 官方镜像作为基础镜像
FROM node:20.6.1
# 设置工作目录
WORKDIR /app
# 复制 package.json 和 package-lock.json 到容器中
COPY package*.json ./
# 切换到./client文件夹并运行npm install
WORKDIR /app/client
RUN npm_config_sharp_binary_host="https://npmmirror.com/mirrors/sharp" \
npm_config_sharp_libvips_binary_host="https://npmmirror.com/mirrors/sharp-libvips" \
npm install sharp --registry=https://registry.npm.taobao.org
RUN npm install --registry=https://registry.npm.taobao.org
# 切换回工作目录
WORKDIR /app
# 安装sharp
RUN npm_config_sharp_binary_host="https://npmmirror.com/mirrors/sharp" \
npm_config_sharp_libvips_binary_host="https://npmmirror.com/mirrors/sharp-libvips" \
npm install sharp --registry=https://registry.npm.taobao.org
# 安装项目依赖
RUN npm install --registry=https://registry.npm.taobao.org
# 复制项目文件到容器中
COPY . .
# 暴露应用的端口
EXPOSE 3001
# 启动应用
CMD ["npm","run", "start2"]