Skip to content

Commit c7e7a34

Browse files
Rename cv .github folder
Add github workflow file Update gw Update gw update gw Update gw update gw Update gw update gw update gw update gw update gw update gw update gw update gw update gw update gw Update gw update gw
1 parent cce7c99 commit c7e7a34

File tree

8 files changed

+83
-0
lines changed

8 files changed

+83
-0
lines changed

.github/workflows/build.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Linux x86_64 incode
2+
on:
3+
push:
4+
tags:
5+
- "*_incode"
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [ '3.10', '3.11' ]
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v2
18+
- name: get tag
19+
id: get_tag
20+
run: |
21+
tag=${{ github.ref_name }}
22+
echo "tag: ${tag//[^0-9]/}"
23+
echo "tag=${tag//[^0-9]/}" >> $GITHUB_OUTPUT
24+
- name: Build wheel
25+
uses: docker/build-push-action@v4
26+
with:
27+
file: Dockerfile.incode_build
28+
platforms: linux/amd64
29+
push: false
30+
context: .
31+
cache-from: type=gha
32+
cache-to: type=gha,mode=max
33+
target: export-stage
34+
build-args: |
35+
PYTHON_VERSION=${{ matrix.python-version }}
36+
OPENCV_TAG=${{ steps.get_tag.outputs.tag }}
37+
tags: |
38+
incodetech/opencv-python-env
39+
outputs: type=local,dest=./
40+
- name: Create release
41+
if: ${{ startsWith(github.ref, 'refs/tags/') == true }}
42+
uses: softprops/action-gh-release@v1
43+
with:
44+
fail_on_unmatched_files: true
45+
files: |
46+
opencv_python_*.whl
File renamed without changes.

Dockerfile.incode_build

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM ubuntu:20.04 as build-stage
2+
3+
ARG PYTHON_VERSION
4+
ARG OPENCV_TAG
5+
ARG NUMPY_VERSION=1.23.5
6+
7+
RUN apt update && apt install -y software-properties-common curl
8+
9+
RUN add-apt-repository -y 'ppa:deadsnakes/ppa' \
10+
&& apt update && apt install -y --no-install-recommends \
11+
python${PYTHON_VERSION} python${PYTHON_VERSION}-venv python${PYTHON_VERSION}-dev \
12+
&& rm -rf /var/lib/apt/lists/* \
13+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
14+
&& pip install -U pip \
15+
&& pip --no-cache-dir install numpy==${NUMPY_VERSION}
16+
17+
ENV VENV_ROOT_PREFIX=/opt/venv
18+
RUN python${PYTHON_VERSION} -m venv ${VENV_ROOT_PREFIX}
19+
20+
21+
WORKDIR /opt/
22+
RUN apt update && apt install -y git build-essential cmake libopenblas-dev liblapacke-dev libjpeg-dev \
23+
# trick to opencv find openblas and numpy headers
24+
&& cp /usr/include/x86_64-linux-gnu/cblas.h /usr/include/ \
25+
&& ln -s /usr/local/lib/python${PYTHON_VERSION}/dist-packages/numpy/core/include/numpy /usr/include/numpy \
26+
&& git clone https://github.com/opencv/opencv-python.git \
27+
&& cd opencv-python \
28+
&& git checkout ${OPENCV_TAG} \
29+
&& git submodule update --init --recursive \
30+
&& export ENABLE_HEADLESS=1 \
31+
&& MAKEFLAGS='-j3' pip wheel . --verbose \
32+
# trick to pack openblas lib to wheel
33+
&& pip install auditwheel patchelf \
34+
&& auditwheel repair *.whl --plat manylinux_2_31_x86_64
35+
36+
FROM scratch AS export-stage
37+
COPY --from=build-stage /opt/opencv-python/wheelhouse /

0 commit comments

Comments
 (0)