forked from opencv/opencv-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.incode_build
More file actions
37 lines (29 loc) · 1.39 KB
/
Dockerfile.incode_build
File metadata and controls
37 lines (29 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ubuntu:22.04 as build-stage
ARG PYTHON_VERSION
ARG OPENCV_TAG
ARG NUMPY_VERSION=1.23.5
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y software-properties-common curl
RUN add-apt-repository -y 'ppa:deadsnakes/ppa' \
&& apt update && apt install -y --no-install-recommends \
python${PYTHON_VERSION} python${PYTHON_VERSION}-venv python${PYTHON_VERSION}-dev \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
&& pip install -U pip \
&& pip --no-cache-dir install numpy==${NUMPY_VERSION}
ENV VENV_ROOT_PREFIX=/opt/venv
RUN python${PYTHON_VERSION} -m venv ${VENV_ROOT_PREFIX}
WORKDIR /opt/
RUN apt update && apt install -y git build-essential cmake libopenblas-dev liblapacke-dev libjpeg-dev \
&& ln -s /usr/local/lib/python${PYTHON_VERSION}/dist-packages/numpy/core/include/numpy /usr/include/numpy \
&& git clone https://github.com/opencv/opencv-python.git \
&& cd opencv-python \
&& git checkout ${OPENCV_TAG} \
&& git submodule update --init --recursive --depth 1 \
&& export ENABLE_HEADLESS=1 \
&& MAKEFLAGS='-j3' pip wheel . --verbose --wheel-dir /opt/opencv-python/wheelhouse \
# trick to pack openblas lib to wheel
&& pip install auditwheel patchelf \
&& auditwheel repair /opt/opencv-python/wheelhouse/*.whl
FROM scratch AS export-stage
COPY --from=build-stage /opt/opencv-python/wheelhouse /