-
-
Save fastfading/5c6ed45998d3927126b302e08feedbe7 to your computer and use it in GitHub Desktop.
OpenCV Static
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.9-alpine3.6 | |
RUN apk add --update alpine-sdk cmake linux-headers | |
# Use an ARG to make it easier to test different versions | |
ARG OPENCV_VERSION=3.2.0 | |
# Download OpenCV | |
# Build OpenCV statically and without features we don't use | |
RUN mkdir -p /opencv && \ | |
curl -L https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz | tar xz -C /opencv --strip-components 1 && \ | |
mkdir -p /opencv/build && \ | |
cd /opencv/build && \ | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DBUILD_ZLIB=ON \ | |
-DBUILD_PNG=ON \ | |
-DWITH_OPENEXR=OFF \ | |
-DWITH_JPEG=OFF \ | |
-DWITH_JASPER=OFF \ | |
-DWITH_TIFF=OFF \ | |
-DWITH_WEBP=OFF \ | |
-DWITH_OPENCL=OFF \ | |
-DWITH_GTK=OFF \ | |
-DWITH_FFMPEG=OFF \ | |
-DWITH_1394=OFF \ | |
-DWITH_IPP=OFF \ | |
-DBUILD_TESTS=OFF \ | |
-DBUILD_PERF_TESTS=OFF \ | |
-DBUILD_opencv_apps=OFF \ | |
.. && \ | |
make -j7 && \ | |
make install && \ | |
cd / && rm -rf /opencv | |
# Set CGO_LDFLAGS so the go linker will pass these to gcc [generated with $(pkg-config --libs --static opencv)] | |
ENV CGO_LDFLAGS "-L/usr/local/lib -L/usr/local/share/OpenCV/3rdparty/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -lzlib -llibpng -lstdc++ -ldl -lm -lpthread -lrt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment