Skip to content

Commit

Permalink
Merge branch 'v3_develop_python_ci' into v3_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jakgra committed Apr 11, 2024
2 parents 059bbed + f33415e commit f955c08
Show file tree
Hide file tree
Showing 9 changed files with 718 additions and 17 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/python-docker-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Publish Docker image
on:
workflow_dispatch:
push:
branches:
- main
- develop
tags:
- 'v*'
jobs:

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, [Linux, ARM], [Linux, ARM64]]
include:
- os: ubuntu-latest
arch: amd64
- os: [Linux, ARM]
arch: armv7
- os: [Linux, ARM64]
arch: armv8
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* || rm -rf /github/workspace/*"
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Set Image Name (development)
id: name
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo "LUXONIS_IMAGE_TAG=${{ github.sha }}-${{ matrix.arch }}" >> $GITHUB_ENV

- name: Set Image Name (release)
if: startsWith(github.ref, 'refs/tags/v') == true
run: echo "LUXONIS_IMAGE_TAG=${GITHUB_REF#refs/*/}-${{ matrix.arch }}" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
file: bindings/python/ci/Dockerfile
tags: luxonis/depthai-library:${{ env.LUXONIS_IMAGE_TAG }}

- name: Cleanup the created image
run: docker image rm luxonis/depthai-library:${{ env.LUXONIS_IMAGE_TAG }}

upload:
needs: [build]
name: Combine into a single multi-arch image and upload tags
runs-on: ubuntu-latest
steps:

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Get Version
id: vars
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}

- name: Build and push (development)
if: startsWith(github.ref, 'refs/tags/v') != true
run: |
docker manifest create \
luxonis/depthai-library:${{ github.sha}} \
--amend luxonis/depthai-library:${{ github.sha }}-amd64 \
--amend luxonis/depthai-library:${{ github.sha }}-armv7 \
--amend luxonis/depthai-library:${{ github.sha }}-armv8
# Push
docker manifest push luxonis/depthai-library:${{ github.sha }}
- name: Build and push (release)
if: startsWith(github.ref, 'refs/tags/v') == true
run: |
docker manifest create \
luxonis/depthai-library:${{ steps.vars.outputs.short_ref }} \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-amd64 \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv7 \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv8
# Push
docker manifest push luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}
docker manifest create \
luxonis/depthai-library:latest \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-amd64 \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv7 \
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv8
docker manifest push luxonis/depthai-library:latest
Loading

0 comments on commit f955c08

Please sign in to comment.