Skip to content

Commit e08aef7

Browse files
update gw
1 parent bf4e7cc commit e08aef7

File tree

2 files changed

+56
-10
lines changed

2 files changed

+56
-10
lines changed

.github/workflows/build.yaml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
name: Linux x86_64 incode
22
on:
33
push:
4-
branches:
5-
- "4.x"
4+
# branches:
5+
# - "4.x"
66
tags:
77
- "*_incode"
88

99
jobs:
1010
build:
1111
runs-on: 'ubuntu-latest'
12+
strategy:
13+
matrix:
14+
python-version: [ '3.10', '3.11' ]
1215
steps:
1316
- name: Checkout
1417
uses: actions/checkout@v3
@@ -20,17 +23,23 @@ jobs:
2023
tag=${{ github.ref_name }}
2124
echo "tag: ${tag//[^0-9]/}"
2225
echo "tag=${tag//[^0-9]/}" >> $GITHUB_OUTPUT
23-
- name: print
24-
run: |
25-
echo "${{ steps.get_tag.outputs.tag }}"
26+
- name: Build wheel
27+
uses: docker/build-push-action@v4
28+
with:
29+
platforms: linux/amd64
30+
push: false
31+
context: .
32+
cache-from: type=gha
33+
cache-to: type=gha,mode=max
34+
target: export-stage
35+
build-args: PYTHON_VERSION=${{ matrix.python-version }},OPENCV_TAG=${{ steps.get_tag.outputs.tag }}
36+
tags: |
37+
incodetech/opencv-python-env
38+
outputs: type=local,dest=./
2639
- name: Create release
2740
if: ${{ startsWith(github.ref, 'refs/tags/') == true }}
2841
uses: softprops/action-gh-release@v1
2942
with:
30-
# token: ${{ secrets.GITHUB_TOKEN }}
31-
# tag_name: ${{ needs.build.outputs.version }}
32-
# name: ${{ needs.build.outputs.version }}
33-
# target_commitish: ${{ github.sha }}
3443
fail_on_unmatched_files: true
3544
files: |
36-
*.txt
45+
*.whl

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='-j2' 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)