123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- FROM alpine AS opencv-builder
- ARG OPENCV_VERSION
- RUN apk --no-cache add python make g++ cmake linux-headers
- RUN mkdir opencv && \
- cd opencv && \
- wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip --no-check-certificate -O opencv-${OPENCV_VERSION}.zip && \
- unzip opencv-${OPENCV_VERSION}.zip && \
- mkdir opencv-${OPENCV_VERSION}/build && \
- cd opencv-${OPENCV_VERSION}/build && \
- cmake_flags="-D CMAKE_BUILD_TYPE=RELEASE \
- -D BUILD_EXAMPLES=OFF \
- -D BUILD_DOCS=OFF \
- -D BUILD_TESTS=OFF \
- -D BUILD_PERF_TESTS=OFF \
- -D BUILD_JAVA=OFF \
- -D BUILD_opencv_apps=OFF \
- -D BUILD_opencv_aruco=OFF \
- -D BUILD_opencv_bgsegm=OFF \
- -D BUILD_opencv_bioinspired=OFF \
- -D BUILD_opencv_ccalib=OFF \
- -D BUILD_opencv_datasets=OFF \
- -D BUILD_opencv_dnn_objdetect=OFF \
- -D BUILD_opencv_dpm=OFF \
- -D BUILD_opencv_fuzzy=OFF \
- -D BUILD_opencv_hfs=OFF \
- -D BUILD_opencv_java_bindings_generator=OFF \
- -D BUILD_opencv_js=OFF \
- -D BUILD_opencv_img_hash=OFF \
- -D BUILD_opencv_line_descriptor=OFF \
- -D BUILD_opencv_optflow=OFF \
- -D BUILD_opencv_phase_unwrapping=OFF \
- -D BUILD_opencv_python3=OFF \
- -D BUILD_opencv_python_bindings_generator=OFF \
- -D BUILD_opencv_reg=OFF \
- -D BUILD_opencv_rgbd=OFF \
- -D BUILD_opencv_saliency=OFF \
- -D BUILD_opencv_shape=OFF \
- -D BUILD_opencv_stereo=OFF \
- -D BUILD_opencv_stitching=OFF \
- -D BUILD_opencv_structured_light=OFF \
- -D BUILD_opencv_superres=OFF \
- -D BUILD_opencv_surface_matching=OFF \
- -D BUILD_opencv_ts=OFF \
- -D BUILD_opencv_xobjdetect=OFF \
- -D BUILD_opencv_xphoto=OFF" && \
- echo $cmake_flags && \
- cmake $cmake_flags .. && \
- make -j $(nproc) && \
- make install
- FROM node:10-alpine AS builder
- ARG OPENCV_VERSION
- ENV OPENCV4NODEJS_DISABLE_AUTOBUILD=1
- RUN apk --no-cache add python make g++
- COPY --from=opencv-builder /opencv/opencv-${OPENCV_VERSION}/build/lib/libopencv* /usr/local/lib/
- COPY --from=opencv-builder /usr/local/include/opencv2 /usr/local/include/opencv2
- COPY --from=opencv-builder /usr/local/share/OpenCV /usr/local/share/OpenCV
- COPY ./bot/package.json ./
- RUN npm install
- WORKDIR /shared/
- COPY ./shared/package.json .
- RUN npm install
- FROM node:14-alpine
- ARG OPENCV_VERSION
- WORKDIR /app
- RUN apk --no-cache add make
- COPY --from=builder node_modules bot/node_modules
- COPY --from=builder /shared/node_modules shared/node_modules
- COPY --from=opencv-builder /opencv/opencv-${OPENCV_VERSION}/build/lib/libopencv* /usr/local/lib/
- COPY --from=opencv-builder /usr/local/include/opencv2 /usr/local/include/opencv2
- COPY --from=opencv-builder /usr/local/share/OpenCV /usr/local/share/OpenCV
- COPY ./bot bot
- COPY ./shared shared
- COPY ./Makefile Makefile
- RUN make build_bot
- WORKDIR /app/bot
- EXPOSE 3000
- CMD npm run start
|