File size: 1,258 Bytes
a152974
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671633f
cd6de25
a152974
 
 
91d644b
a152974
 
 
112e437
a152974
 
 
a66362a
bfe2c10
 
 
a152974
 
3725eb7
a152974
112e437
9c1a9c9
d4c9a97
a152974
3c69863
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM node:latest

# 添加 Python3 和相关工具
RUN apt-get update && apt-get install -y python3 python3-pip python3.11-venv

# 安装必要的工具和依赖包
RUN apt-get update && apt-get install -y \
    build-essential \
    python-is-python3 \
    cmake \
    git \
    ffmpeg \
    libavcodec-dev \
    libavformat-dev \
    libswscale-dev \
    libopencv-dev \
    v4l-utils \
    libv4l-dev \
    libgtk2.0-dev \
    pkg-config \
    gstreamer1.0-tools \
    gstreamer1.0-plugins-base \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad \
    gstreamer1.0-plugins-ugly \
    gstreamer1.0-libav

# 添加 node-gyp 全局
RUN npm install -g node-gyp

# 创建工作目录并克隆 OpenCV 的源码库
WORKDIR /app
RUN git clone https://github.com/opencv/opencv.git ./opencv

# 切换到 build 目录进行配置与编译
WORKDIR /app/build
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

# 使用并行编译进程
RUN make -j$(nproc)
RUN make install

# 全部复制到工作目录
COPY . .

# 安装依赖
RUN npm install
RUN npm install serve-static

# 暴露端口
EXPOSE 7860

# 运行
CMD ["node","egg-api"]