Skip to content

Commit

Permalink
docker: use OpenCV patch to build fully static GStreamer with plugins…
Browse files Browse the repository at this point in the history
… included

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 22, 2024
1 parent ac4c8bb commit 9050a34
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Dockerfile.opencv-static-alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN apk update && apk add --no-cache \
libxml2-dev \
bison \
flex \
glib-dev \
glib-dev glib-static \
gobject-introspection-dev \
libcap-dev \
libcap-utils \
Expand All @@ -54,7 +54,15 @@ RUN apk update && apk add --no-cache \
COPY --from=gstreamer-amd64 /gstbin/lib /usr/local/lib
COPY --from=gstreamer-amd64 /gstbin/include/gstreamer-1.0/gst /usr/local/include/gst

# patch opencv for static gstreamer
COPY ./patches/gstreamer-full.patch /opencv/opencv
RUN cd /opencv/opencv && \
patch -p1 < gstreamer-full.patch

# Build OpenCV
ENV PKG_CONFIG_PATH=/usr/local/lib/gstreamer-1.0/pkgconfig:/usr/local/lib/pkgconfig
ENV GSTREAMER_STATIC_LIB=/usr/local/lib/gstreamer-1.0

WORKDIR /opencv/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
Expand Down Expand Up @@ -134,7 +142,7 @@ RUN apk update && apk add --no-cache \
libxml2-dev \
bison \
flex \
glib-dev \
glib-dev glib-static \
gobject-introspection-dev \
libcap-dev \
libcap-utils \
Expand All @@ -144,7 +152,15 @@ RUN apk update && apk add --no-cache \
COPY --from=gstreamer-arm64 /gstbin/lib /usr/local/lib
COPY --from=gstreamer-arm64 /gstbin/include/gstreamer-1.0/gst /usr/local/include/gst

# patch opencv for static gstreamer
COPY ./patches/gstreamer-full.patch /opencv/opencv
RUN cd /opencv/opencv && \
patch -p1 < gstreamer-full.patch

# Build OpenCV
ENV PKG_CONFIG_PATH=/usr/local/lib/gstreamer-1.0/pkgconfig:/usr/local/lib/pkgconfig
ENV GSTREAMER_STATIC_LIB=/usr/local/lib/gstreamer-1.0

WORKDIR /opencv/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
Expand Down

0 comments on commit 9050a34

Please sign in to comment.