Hi Steve,
I have already done this process virtually since I have Docker installed on
my machine. However, I actually have the router and I am working with the
router itself. On top of that, the docker has nothing to do with Opencv in
this case since the docker “FROM” image is Yocto. The router’s space is
only 4G, installing docker on the router will take so much space. Butlet'ss
say we want to install docker and we will use image like ubuntu. The way to
install OpenCV would be like this:
```
FROM ubuntu:16.04
RUN mkdir -p /home/myapp
COPY . /home/myapp
RUN cd /home/myapp
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python python-dev python-pip
build-essential cmake git pkg-config libjpeg8-dev libtiff5-dev
libjasper-dev libpng12-dev libgtk2.0-dev libavcodec-dev libavformat-dev
libswscale-dev libv4l-dev libatlas-base-dev gfortran libavresample-dev
libgphoto2-dev libgstreamer-plugins-base1.0-dev libdc1394-22-dev && \
cd /opt && \
git clone
https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib && \
git checkout 3.4.0 && \
cd /opt && \
git clone
https://github.com/opencv/opencv.git && \
cd opencv && \
git checkout 3.4.0 && \
mkdir build && \
cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python2.7 \
-D BUILD_EXAMPLES=OFF /opt/opencv && \
make -j $(nproc) && \
make install && \
ldconfig && \
apt-get purge -y git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm -rf /opt/opencv*
CMD /bin/bash
RUN cd /home/myapp && \
g++ -std=c++11 main.cpp `pkg-config --libs --cflags opencv` -o myapp
FROM ubuntu:16.04
RUN mkdir -p /home/myapp
COPY . /home/myapp
RUN cd /home/myapp
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python python-dev python-pip
build-essential cmake git pkg-config libjpeg8-dev libtiff5-dev
libjasper-dev libpng12-dev libgtk2.0-dev libavcodec-dev libavformat-dev
libswscale-dev libv4l-dev libatlas-base-dev gfortran libavresample-dev
libgphoto2-dev libgstreamer-plugins-base1.0-dev libdc1394-22-dev && \
cd /opt && \
git clone
https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib && \
git checkout 3.4.0 && \
cd /opt && \
git clone
https://github.com/opencv/opencv.git && \
cd opencv && \
git checkout 3.4.0 && \
mkdir build && \
cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python2.7 \
-D BUILD_EXAMPLES=OFF /opt/opencv && \
make -j $(nproc) && \
make install && \
ldconfig && \
apt-get purge -y git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm -rf /opt/opencv*
CMD /bin/bash
RUN cd /home/myapp && \
g++ -std=c++11 main.cpp `pkg-config --libs --cflags opencv` -o myapp
```
I have attached this dockerfile also. I have tested this and it works but
it takes so much space i guess. Can you help me please?
Just to make things clear. I have to run the application using OpenCv & C++
on the actual (physical) router and I only have 4G.