mmdhx commited on
Commit
d73cd42
·
verified ·
1 Parent(s): a821144

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -16
Dockerfile CHANGED
@@ -23,31 +23,21 @@ RUN git clone https://github.com/opencv/opencv.git ./opencv
23
 
24
  # 切换到 build 目录进行配置与编译
25
  WORKDIR /app/build
26
- RUN cmake -D WITH_FFMPEG=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/app/opencv_4.1.0 ..
27
  RUN make -j$(nproc)
28
  RUN make install
29
 
30
- # 设置环境变量以便找到 OpenCV 的二进文件、库文件等
31
- ENV PATH="/app/build:${PATH}"
32
- ENV LD_LIBRARY_PATH="/app/build/lib"
33
-
34
- # 创建 Python 虚拟环境
35
- RUN python3 -m venv /app/venv
36
-
37
- # 使用 bash 来运行 pip install 命令(确保虚拟环境被激活)
38
- RUN /bin/bash -c "source /app/venv/bin/activate && pip3 install numpy"
39
 
40
- # 安装 opencv4nodejs
41
- RUN npm install -g opencv4nodejs
42
 
43
  # 删除不必要的文件以节省空间
44
  RUN cd /app && rm -rf opencv build
45
 
46
- # 全部复制到工作目录
47
- COPY . .
48
-
49
  # 暴露端口
50
  EXPOSE 7860
51
 
52
  # 运行
53
- CMD ["node", "egg-api.js"]
 
23
 
24
  # 切换到 build 目录进行配置与编译
25
  WORKDIR /app/build
26
+ RUN cmake -D WITH_FFMPEG=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ../opencv
27
  RUN make -j$(nproc)
28
  RUN make install
29
 
30
+ # 全部复到工作目录
31
+ COPY . .
 
 
 
 
 
 
 
32
 
33
+ # 安装依赖
34
+ RUN npm install
35
 
36
  # 删除不必要的文件以节省空间
37
  RUN cd /app && rm -rf opencv build
38
 
 
 
 
39
  # 暴露端口
40
  EXPOSE 7860
41
 
42
  # 运行
43
+ CMD ["node", "egg-api.js"]