Skip to content

Commit c8680ef

Browse files
authored
Merge pull request #187 from artiomn/master
SDK image added
2 parents 3363673 + 9e9e627 commit c8680ef

3 files changed

Lines changed: 43 additions & 13 deletions

File tree

.github/workflows/cmake-build.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ jobs:
6363
shell: bash
6464
run: |
6565
echo "build-output-dir=build_${{ matrix.c_compiler }}" >> "$GITHUB_OUTPUT"
66+
echo "KNP_IMAGE_VERSION=v2.0.${{ github.run_number }}" >> $GITHUB_ENV
67+
echo "KNP_BUILD_IMAGE_NAME=${{ vars.DOCKERHUB_LOGIN }}/knp-build-image:latest" >> $GITHUB_ENV
68+
echo "KNP_SDK_IMAGE_NAME=${{ vars.DOCKERHUB_LOGIN }}/knp-sdk-image:${{ env.KNP_IMAGE_VERSION }}" >> $GITHUB_ENV
6669
6770
# Install support for non-x86 emulation in Docker via QEMU.
6871
# Platforms: linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x,
@@ -83,40 +86,57 @@ jobs:
8386
-S .
8487
8588
- name: Build
86-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP kasperskydh/knp-build-image cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel ${{ matrix.build_threads_count }}
89+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ KNP_BUILD_IMAGE_NAME }} cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel ${{ matrix.build_threads_count }}
8790
timeout-minutes: 180
8891

8992
- name: C++ tests
90-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp/tests kasperskydh/knp-build-image ctest -V
93+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp/tests ${{ KNP_BUILD_IMAGE_NAME }} ctest -V
9194
timeout-minutes: 180
9295

96+
# TODO: run before configure?
9397
- name: Analyze C++ code with lizard
94-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP kasperskydh/knp-build-image ci/run_lizard.py
98+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ KNP_BUILD_IMAGE_NAME }} ci/run_lizard.py
9599
continue-on-error: true
96100

97101
- name: Analyze Python code with PyLint
98-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP kasperskydh/knp-build-image ci/run_pylint.py ${{ steps.strings.outputs.build-output-dir }}/knp_python_framework/knp ${{ steps.strings.outputs.build-output-dir }}
102+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ KNP_BUILD_IMAGE_NAME }} ci/run_pylint.py ${{ steps.strings.outputs.build-output-dir }}/knp_python_framework/knp ${{ steps.strings.outputs.build-output-dir }}
99103

100104
- name: Analyze Python code with Bandit
101-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP kasperskydh/knp-build-image /usr/bin/bandit -r -lll -x ".*fixtures" /KNP/knp/python-framework ${{ steps.strings.outputs.build-output-dir }}/knp_python_framework/ -o ${{ steps.strings.outputs.build-output-dir }}/bandit.log
105+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ KNP_BUILD_IMAGE_NAME }} /usr/bin/bandit -r -lll -x ".*fixtures" /KNP/knp/python-framework ${{ steps.strings.outputs.build-output-dir }}/knp_python_framework/ -o ${{ steps.strings.outputs.build-output-dir }}/bandit.log
102106

103107
- name: Python tests
104-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp_python_framework kasperskydh/knp-build-image pytest
108+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp_python_framework ${{ KNP_BUILD_IMAGE_NAME }} pytest
105109

106110
- name: Create deb packages
107-
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }} kasperskydh/knp-build-image cpack -G DEB
111+
run: docker run --platform=linux/${{ matrix.arch }} --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }} ${{ KNP_BUILD_IMAGE_NAME }} cpack -G DEB
108112
timeout-minutes: 180
109113

114+
- name: Create SDK Docker image
115+
if: matrix.c_compiler == 'gcc'
116+
uses: docker/build-push-action@v6
117+
with:
118+
platforms: linux/${{ matrix.arch }}
119+
context: "{{defaultContext}}:docker/sdk-image"
120+
load: true
121+
push: true
122+
build-args: |
123+
KNP_IMAGE_VERSION=${{ env.KNP_IMAGE_VERSION }}
124+
KNP_PACKAGES_DIR=${{ steps.strings.outputs.build-output-dir }}/_packages/
125+
tags: |
126+
${{ vars.DOCKERHUB_LOGIN }}/knp-sdk-image:${{ env.KNP_IMAGE_VERSION }}
127+
${{ vars.DOCKERHUB_LOGIN }}/knp-sdk-image:latest
128+
timeout-minutes: 180
129+
continue-on-error: false
110130
- name: Upload deb packages
111131
if: matrix.c_compiler == 'gcc'
112-
uses: actions/upload-artifact@v4
132+
uses: actions/upload-artifact@v7
113133
with:
114134
name: pkg-deb-${{ matrix.arch }}
115135
path: ${{ steps.strings.outputs.build-output-dir }}/_packages/
116136

117137
- name: Upload Python wheel
118138
if: matrix.c_compiler == 'gcc'
119-
uses: actions/upload-artifact@v4
139+
uses: actions/upload-artifact@v7
120140
with:
121141
name: pkg-python-${{ matrix.arch }}
122142
path: ${{ steps.strings.outputs.build-output-dir }}/knp_python_framework/dist/knp-*.whl
@@ -178,7 +198,7 @@ jobs:
178198
- name: Install OpenCV via vcpkg
179199
if: matrix.c_compiler == 'cl'
180200
run: vcpkg install opencv:x64-windows
181-
201+
182202
- name: Configure CMake
183203
env:
184204
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

.github/workflows/docker-build-image.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Set Images Version
22-
run: echo "KNP_IMAGE_VERSION=v1.0.${{ github.run_number }}" >> $GITHUB_ENV
22+
run: echo "KNP_IMAGE_VERSION=v2.0.${{ github.run_number }}" >> $GITHUB_ENV
2323
- name: Set up Docker
2424
uses: docker/setup-docker-action@v5
2525
with:
@@ -46,7 +46,9 @@ jobs:
4646
context: "{{defaultContext}}:docker/base-image"
4747
load: true
4848
push: true
49-
tags: ${{ vars.DOCKERHUB_LOGIN }}/knp-base-image:${{ env.KNP_IMAGE_VERSION }}
49+
tags: |
50+
${{ vars.DOCKERHUB_LOGIN }}/knp-base-image:${{ env.KNP_IMAGE_VERSION }}
51+
${{ vars.DOCKERHUB_LOGIN }}/knp-base-image:latest
5052
build-args: KNP_IMAGE_VERSION=${{ env.KNP_IMAGE_VERSION }}
5153
timeout-minutes: 180
5254
continue-on-error: false
@@ -58,6 +60,8 @@ jobs:
5860
load: true
5961
push: true
6062
build-args: KNP_IMAGE_VERSION=${{ env.KNP_IMAGE_VERSION }}
61-
tags: ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image:${{ env.KNP_IMAGE_VERSION }}
63+
tags: |
64+
${{ vars.DOCKERHUB_LOGIN }}/knp-build-image:${{ env.KNP_IMAGE_VERSION }}
65+
${{ vars.DOCKERHUB_LOGIN }}/knp-build-image:latest
6266
timeout-minutes: 180
6367
continue-on-error: false

docker/sdk-image/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
ARG KNP_IMAGE_VERSION=2.0.0
18+
ARG KNP_PACKAGES_DIR
1819
ARG TARGETPLATFORM
1920
FROM kasperskydh/knp-base-image:${KNP_IMAGE_VERSION}
2021

@@ -34,3 +35,8 @@ RUN \
3435
&& chsh -s $(which zsh) \
3536
&& sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
3637
&& cd /knp
38+
39+
COPY NOTICE.txt .
40+
COPY ${PACKAGES_DIR}/*.deb /knp
41+
42+
RUN DEBIAN_FRONTEND=noninteractive dpkg -i /knp/*.deb

0 commit comments

Comments
 (0)