luoyutianyang commited on
Commit
732c9c1
·
verified ·
1 Parent(s): 0bcace1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -18
Dockerfile CHANGED
@@ -26,34 +26,29 @@ RUN apt-get update && apt-get install -y \
26
  gstreamer1.0-plugins-ugly \
27
  gstreamer1.0-libav
28
 
29
- # 安装pnpm
30
  RUN npm install -g pnpm
31
 
32
- # 创建工作目录并克隆 OpenCV 的源码库
33
- WORKDIR /app
34
- RUN git clone --depth 1 https://github.com/opencv/opencv.git ./opencv
35
 
36
- # 切换到 build 目录进行配置与编译
37
- WORKDIR /app/build
38
- RUN cmake -D WITH_FFMPEG=ON -D WITH_GSTREAMER=ON -D WITH_V4L=ON -D WITH_LIBV4L=ON -D WITH_GTK=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ../opencv
39
 
40
- # 使用并行编译进程
41
- RUN make -j4
42
- RUN make install
 
 
 
43
 
44
- # 全部复制到工作目录
45
  WORKDIR /app
46
  COPY . .
47
 
48
- # 安装依赖
49
  RUN pnpm install
50
 
51
- # 批准构建脚本并选择所有需要的构建脚本
52
- RUN (sleep 1; echo ' '; sleep 1; echo ' '; sleep 1; echo ' '; sleep 1; echo 'y') | pnpm approve-builds opencv-build opencv4nodejs sharp
53
-
54
- # 编译 opencv4nodejs
55
- RUN pnpm rebuild opencv4nodejs
56
-
57
  # 安装 serve-static
58
  RUN pnpm install serve-static
59
 
 
26
  gstreamer1.0-plugins-ugly \
27
  gstreamer1.0-libav
28
 
29
+ # 安装 pnpm
30
  RUN npm install -g pnpm
31
 
32
+ # 安装全局 opencv-build
33
+ RUN npm install --global opencv-build
 
34
 
35
+ # 确认全局 node_modules 目录
36
+ RUN npm -g root
 
37
 
38
+ # 克隆 opencv4nodejs 仓库并安装依赖项
39
+ RUN cd $(npm -g root) && \
40
+ git clone https://github.com/justadudewhohacks/opencv4nodejs.git && \
41
+ cd opencv4nodejs && \
42
+ npm install -g nan native-node-utils npmlog && \
43
+ node install/install.js
44
 
45
+ # 创建工作目录
46
  WORKDIR /app
47
  COPY . .
48
 
49
+ # 安装项目依赖
50
  RUN pnpm install
51
 
 
 
 
 
 
 
52
  # 安装 serve-static
53
  RUN pnpm install serve-static
54