Dockerfile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. FROM debian:stable-slim
  2. RUN apt-get -qq update \
  3. && apt-get install -y --no-install-recommends \
  4. bash \
  5. curl \
  6. git \
  7. ca-certificates \
  8. build-essential \
  9. python3-pip \
  10. python3-venv \
  11. libssl-dev \
  12. libglib2.0-dev \
  13. libxml2-dev \
  14. libjpeg-dev \
  15. libpng-dev \
  16. libwebp-dev \
  17. librsvg2-dev \
  18. libexif-dev \
  19. liblcms2-dev \
  20. libavcodec-dev \
  21. libavformat-dev \
  22. libavutil-dev \
  23. libswscale-dev \
  24. libopencv-core-dev \
  25. libopencv-imgproc-dev \
  26. libopencv-objdetect-dev \
  27. libopencv-dnn-dev \
  28. && python3 -m venv /root/.python \
  29. && /root/.python/bin/pip install meson ninja \
  30. && rm -rf /var/lib/apt/lists/*
  31. RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \
  32. && export PATH="/root/.cargo/bin:$PATH" \
  33. && cargo install cargo-c \
  34. && cd /root \
  35. && git clone --depth 1 https://github.com/DarthSim/quantizr.git \
  36. && cd quantizr \
  37. && cargo cinstall --release --library-type=cdylib \
  38. && rm -rf /root/.rustup /root/.cargo
  39. ENV PATH="/root/.python/bin:$PATH"
  40. ENV LD_LIBRARY_PATH="/usr/local/lib"
  41. RUN \
  42. mkdir /root/vips \
  43. && cd /root/vips \
  44. && curl -s -S -L -o vips_releases.json "https://api.github.com/repos/libvips/libvips/releases" \
  45. && for VIPS_VERSION in "8.13" "8.14"; do \
  46. mkdir $VIPS_VERSION \
  47. && export VIPS_RELEASE=$(grep -m 1 "\"tag_name\": \"v$VIPS_VERSION." vips_releases.json | sed -E 's/.*"v([^"]+)".*/\1/') \
  48. && echo "Building Vips $VIPS_RELEASE as $VIPS_VERSION" \
  49. && curl -s -S -L -o libvips-$VIPS_RELEASE.tar.gz https://github.com/libvips/libvips/archive/refs/tags/v$VIPS_RELEASE.tar.gz \
  50. && tar -xzf libvips-$VIPS_RELEASE.tar.gz \
  51. && cd libvips-$VIPS_RELEASE \
  52. && meson setup _build \
  53. --buildtype=release \
  54. --strip \
  55. --prefix=/root/vips/$VIPS_VERSION \
  56. --libdir=lib \
  57. -Dgtk_doc=false \
  58. -Dintrospection=false \
  59. && ninja -C _build \
  60. && ninja -C _build install \
  61. && cd .. \
  62. && rm -rf libvips-$VIPS_RELEASE.tar.gz libvips-$VIPS_RELEASE; \
  63. done
  64. RUN echo "Name: OpenCV\n" \
  65. "Description: Open Source Computer Vision Library\n" \
  66. "Version: 4.5.1\n" \
  67. "Libs: -L/usr/lib/x86_64-linux-gnu -lopencv_dnn -lopencv_objdetect -lopencv_imgproc -lopencv_core\n" \
  68. "Libs.private: -ldl -lm -lpthread -lrt\n" \
  69. "Cflags: -I/usr/include/opencv4\n" \
  70. > /usr/lib/x86_64-linux-gnu/pkgconfig/opencv4.pc
  71. WORKDIR /go/src
  72. ENTRYPOINT [ "/bin/bash" ]