Spaces:
Build error
Build error
| # Usar una imagen base de Ubuntu | |
| FROM ubuntu:22.04 | |
| # Establecer variables de entorno no interactivas para evitar prompts durante la instalación | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && apt-get upgrade -y | |
| RUN apt-get install pciutils -y | |
| RUN lspci | grep -i vga | |
| # Instalar dependencias necesarias | |
| RUN apt-get install -y \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| libgstreamer-plugins-bad1.0-dev \ | |
| gstreamer1.0-plugins-base \ | |
| gstreamer1.0-plugins-good \ | |
| gstreamer1.0-plugins-bad \ | |
| gstreamer1.0-plugins-ugly \ | |
| gstreamer1.0-libav \ | |
| gstreamer1.0-tools \ | |
| gstreamer1.0-x \ | |
| gstreamer1.0-alsa \ | |
| gstreamer1.0-gl \ | |
| gstreamer1.0-gtk3 \ | |
| gstreamer1.0-qt5 \ | |
| gstreamer1.0-pulseaudio \ | |
| cmake \ | |
| gcc \ | |
| python3-dev \ | |
| python3-pip \ | |
| git | |
| # Actualizar pip y instalar numpy | |
| RUN python3 -m pip install --upgrade pip setuptools wheel | |
| RUN python3 -m pip install numpy | |
| RUN mkdir -p /opencv | |
| WORKDIR /opencv | |
| # Clonar los repositorios de OpenCV y OpenCV contrib | |
| RUN git clone https://github.com/opencv/opencv.git --depth 1 | |
| RUN git clone https://github.com/opencv/opencv_contrib.git --depth 1 | |
| # Crear directorios de construcción | |
| RUN mkdir -p /opencv/build /opencv/cmake | |
| RUN ls -lah | |
| # Establecer el directorio de trabajo | |
| WORKDIR /opencv/cmake | |
| # Obtener el directorio de instalación de paquetes de Python | |
| RUN PYTHONPATH=$(python3 -c "import site; print(site.getsitepackages()[0])") | |
| # Configurar la construcción con CMake | |
| RUN cmake -D CMAKE_BUILD_TYPE=Release \ | |
| -D CMAKE_INSTALL_PREFIX=/opencv/build \ | |
| -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ | |
| -D WITH_GSTREAMER=ON \ | |
| -D WITH_TBB=ON \ | |
| -D WITH_V4L=ON \ | |
| -D WITH_OPENGL=OFF \ | |
| -D WITH_FFMPEG=OFF \ | |
| -D WITH_GTK=ON \ | |
| -D OPENCV_ENABLE_NONFREE=ON \ | |
| -D BUILD_EXAMPLES=ON \ | |
| -D BUILD_opencv_python3=ON \ | |
| -D OPENCV_PYTHON3_INSTALL_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") \ | |
| -D PYTHON_EXECUTABLE=$(which python3) \ | |
| -D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ | |
| -D PYTHON3_LIBRARIES=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))") \ | |
| # -D WITH_OPENCL=OFF \ | |
| # -D WITH_SYCL=OFF \ | |
| ../opencv | |
| # Compilar e instalar OpenCV | |
| RUN make -j$(nproc) | |
| RUN make install | |
| RUN ldconfig | |
| # Mensaje de advertencia sobre OpenGL | |
| RUN echo "es posible que OPENGL no funcione por estar en un entorno limitado" | |
| # Establecer el directorio de trabajo por defecto | |
| WORKDIR /opencv/build | |