-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (54 loc) · 2.67 KB
/
Dockerfile
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
55
56
57
58
# Use the official Ubuntu 22.04 base image
FROM ubuntu:22.04
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.79.0
# Update package lists
RUN apt update -y && apt -y --no-install-recommends install tzdata
# Upgrade existing packages
RUN apt upgrade -y
RUN apt install build-essential cmake git libgtk-3-dev \
pkg-config libavcodec-dev libavformat-dev libswscale-dev \
libv4l-dev libxvidcore-dev libx264-dev openexr libatlas-base-dev \
libopenexr-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-dev gfortran python3-pip curl -y
# Install Meson and Ninja
RUN python3 -m pip install meson
RUN python3 -m pip install ninja
# --> Build OpenCV
RUN mkdir /opencv_build
WORKDIR /opencv_build
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
RUN mkdir -p /opencv_build/opencv/build
WORKDIR /opencv_build/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D OPENCV_GENERATE_PKGCONFIG=ON -D BUILD_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=/opencv_build/opencv_contrib/modules ..
RUN make -j3
RUN make install
RUN mkdir -p /opencv_build/opencv/build_static
WORKDIR /opencv_build/opencv/build_static
RUN cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_SHARED_LIBS=OFF -D BUILD_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=/opencv_build/opencv_contrib/modules ..
RUN make -j3
RUN pkg-config --modversion opencv4
RUN ldconfig
# <-- Luxonis DepthAI
RUN mkdir /depthai
WORKDIR /depthai
RUN git clone https://github.com/luxonis/depthai-core.git
WORKDIR /depthai/depthai-core
RUN git submodule update --init --recursive
# Shared library
RUN cmake -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D DEPTHAI_ENABLE_CURL=OFF
RUN cmake --build build --target install --parallel 2
# Static build
RUN cmake -S . -B build_static -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D DEPTHAI_ENABLE_CURL=OFF
RUN cmake --build build_static --target install --parallel 2
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION
RUN chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
WORKDIR /
RUN ldconfig
# End of Dockerfile