From d1a88638cadf924ffaa6bed4e69841be24cc7daf Mon Sep 17 00:00:00 2001 From: mahdi Date: Sun, 14 May 2023 15:03:55 +0330 Subject: [PATCH 1/2] wip: update dependencies --- README.md | 14 +++--- build-stage/Dockerfile | 110 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 115 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e7cea1d..0586d84 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ ## What's in build-stage image? - - Alpine 3.7 - - FFMPEG 4.0 - - Golang 1.10 - - OpenCV 4.0.1 - - OpenCV 4.0.1 contrib packages required by GoCV + - Alpine 3.18 + - FFMPEG 4.2 + - Golang 1.20 + - OpenCV 4.7.0 + - OpenCV 4.7.0 contrib packages required by GoCV ## What's in runtime image? - - Alpine 3.7 + - Alpine 3.18 - Whatever you need there ## Purpose @@ -30,7 +30,7 @@ pushd runtime && docker build -t denismakogon/gocv-alpine:4.0.1-runtime .; popd ## Build the build-stage image ```bash -pushd build-stage && docker build -t denismakogon/gocv-alpine:4.0.1-buildstage .; popd +pushd build-stage && docker build -t denismakogon/gocv-alpine:4.7.0-buildstage .; popd ``` ## Test sample: diff --git a/build-stage/Dockerfile b/build-stage/Dockerfile index ec50642..141912a 100644 --- a/build-stage/Dockerfile +++ b/build-stage/Dockerfile @@ -1,8 +1,114 @@ -FROM denismakogon/ffmpeg-alpine:4.0-golang +FROM golang:1.20.4-alpine3.18 LABEL maintainer="Denis Makogon. mail: lildee1991@gmail.com" +LABEL maintainer="Mahdi Imani. " -ENV OPENCV_VERSION=4.0.1 +ENV FFMPEG_VERSION=4.2.9 + +ENV FFMPEG_CORE="bash \ + tzdata \ + libass \ + libstdc++ \ + libpng \ + libjpeg \ + xvidcore \ + x264-libs \ + x265 \ + libvpx \ + libvorbis \ + opus \ + lame \ + fdk-aac \ + freetype \ + libressl \ + jasper-libs \ + libavc1394 \ + yasm" + +ENV RUNTIME_DEPS="coreutils \ + make \ + cmake \ + gcc \ + g++ \ + clang \ + linux-headers \ + git \ + curl" + +ENV BUILD_DEPS="fdk-aac-dev \ + freetype-dev \ + x264-dev \ + x265-dev \ + yasm-dev \ + libogg-dev \ + libvorbis-dev \ + opus-dev \ + libvpx-dev \ + lame-dev \ + xvidcore-dev \ + libass-dev \ + libressl-dev \ + musl-dev \ + build-base \ + libjpeg-turbo-dev \ + libpng-dev \ + jasper-dev \ + libavc1394-dev \ + libavc1394-dev \ + clang-dev" + +# FFMPEG +RUN apk update && \ + apk add --no-cache apk-tools && \ + echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ + apk update && \ + apk add --no-cache --virtual .runtime-deps ${RUNTIME_DEPS} && \ + apk add --no-cache ${FFMPEG_CORE} && \ + apk add --no-cache --virtual .build-deps ${BUILD_DEPS} && \ + export SRC=/usr \ + DIR=$(mktemp -d) && cd ${DIR} && \ + curl -Os http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \ + tar xzvf ffmpeg-${FFMPEG_VERSION}.tar.gz && \ + cd ffmpeg-${FFMPEG_VERSION} && \ + ./configure \ + --prefix="${SRC}" \ + --extra-cflags="-I${SRC}/include" \ + --extra-ldflags="-L${SRC}/lib" \ + --bindir="${SRC}/bin" \ + --extra-libs=-ldl \ + --enable-version3 \ + --enable-libmp3lame \ + --enable-pthreads \ + --enable-libx264 \ + --enable-libxvid \ + --enable-gpl \ + --enable-postproc \ + --enable-nonfree \ + --enable-avresample \ + --enable-libfdk-aac \ + --disable-debug \ + --enable-small \ + --enable-libtls \ + --enable-libx265 \ + --enable-libopus \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libfreetype \ + --enable-libass \ + --enable-shared \ + --enable-pic && \ + make && \ + make install && \ + make distclean && \ + hash -r && \ + cd /tmp && \ + rm -rf ${DIR} && \ + apk del .build-deps && \ + apk del .runtime-deps && \ + rm -rf /var/cache/apk/* + + +ENV OPENCV_VERSION=4.7.0 ENV BUILD="ca-certificates \ git \ build-base \ From a34f78ca7ae036606b805b9e393821e56bbcdabd Mon Sep 17 00:00:00 2001 From: mahdi Date: Sun, 14 May 2023 15:07:15 +0330 Subject: [PATCH 2/2] docs: update instructions #19 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0586d84..e6a7317 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# GoCV-compatible OpenCV 4.0.1 Alpine 3.7 Docker images +# GoCV-compatible OpenCV 4.7.0 Alpine 3.18 Docker images ## What's in build-stage image? - Alpine 3.18 - - FFMPEG 4.2 + - FFMPEG 4.2.9 - Golang 1.20 - OpenCV 4.7.0 - OpenCV 4.7.0 contrib packages required by GoCV @@ -45,5 +45,5 @@ docker run --rm -ti denismakogon/gocv-alpine:test the output should be the following: ```bash gocv version: 0.18.0 -opencv lib version: 4.0.1 +opencv lib version: 4.7.0 ```