From a60589ece018f38e27794c78534a5d1a4015f597 Mon Sep 17 00:00:00 2001 From: Daniil Pastukhov Date: Thu, 28 Sep 2023 22:18:08 +0200 Subject: [PATCH] Rework structure and images (#22) * Rework dockerfiles and build process (#20) * Improve files structure * Build libusb in external/libusb folder * Remove dead code in dockerfiles * Fix libusb file naming * Fix ros2humble dockerfiles * Use prebuilt libusb in dockerfiles * Use wheels instead of building depthai * Remove excessive apt-get clean * Remove excessive apt-get -y flag * Merge origin and base stages * Remove excessive apt-get purge - It was the last command in build stage, but final stage is not based on build stage * Remove update-alternatives for python * Remove experimental syntax support * Always ensure python3 is installed * Always upgrade pip, setuptools and wheel * Add distinctipy to regular images * Fix comment * Remove unused OPENCV_VERSION arg * Always set DEBIAN_FRONTEND=noninteractive * Use upper case for dockerfile instructions * Add base dockerfile with ROBOTICS_VISION_CORE arg * Add BASE_IMAGE arg * Use VARIANT arg to install python packages * Remove hardcoded dockerfiles - Use base dockerfile instead * Remove depthai branch from workflow dispatch inputs * Remove unused paths filter in push trigger * Format publish-base-images.yml workflow file * Remove repository dispatch trigger * Fix style in scripts * Add DEPTHAI_VERSION arg * Move precompiled libusb to docker build context * Remove unused dependencies installation from custom dockerfiles * Format setup-remote-builder.sh script * Rework build scripts * Add DEPTHAI_SDK_VERSION arg * Add ROBOTHUB_OAK_VERSION arg * Update README.md * Fix hardcoded base image in build script * Run scripts with bash instead of sh * Provide script to install specific version of depthai * Remove unused pyproject.toml * Don't upgrade pip, setuptools and wheels - Upgrade doesn't uninstall previous versions installed by apt-get - Image size is reduced by ~38MB * Build and publish libusb using GitHub workflow * Temporarily remove push trigger for buliding images * Fix yaml syntax * Use sudo apt-get to install dependencies * Set fail-fast to false in libusb workflow * Add aws cli installing to libusb workflow * Fix aws cli installation * Download precompiled libusb from rh-public in dockerfiles * Revert "Temporarily remove push trigger for buliding images" This reverts commit bb9923287cf04e37ed76e77d2088b27c9eda3b64. * Improve installation scripts * Add core image with no preinstalled packages * Use buildjet runners to build docker images (#21) * Remove build workflow that uses aws * Remove --builder and --platform flags * Add architecture suffix to image tags * Remove image version derivation from scripts * Add make_manifests.sh script * Add new image build workflow that uses buildjet * Add checkout action to make-manifests job * Add name to all jobs/steps * Remove unused NODE_AUTH_TOKEN env variable * Use buildx imagetools to make manifests - Fix issue with unknown manifest * Remove on push to main trigger * Publish to robothub-app-v2 on release, otherwise to robothub-app-v2-dev * Remove on push to develop trigger * Change depthai-sdk version to 1.12.1 * Use robothub 2.2.0 (renamed robothub-oak) --------- Co-authored-by: OpeningNew <44349518+OpeningNew@users.noreply.github.com> Co-authored-by: Nikolay Tsoy --- .github/workflows/publish-base-images.yml | 84 --------- .github/workflows/publish-images.yml | 71 ++++++++ .github/workflows/publish-patched-libusb.yml | 48 +++++ README.md | 28 ++- context/download-patched-libusb | 22 +++ context/install-depthai-version | 14 ++ context/install-luxonis-packages | 22 +++ context/requirements-minimal.txt | 7 + context/requirements-regular.txt | 9 + docker_images/minimal/Dockerfile | 166 ------------------ docker_images/rae/builtin_app/Dockerfile | 72 -------- docker_images/rae/provisioning_app/Dockerfile | 71 -------- docker_images/regular/Dockerfile | 78 -------- docker_images/ros/humble/minimal/Dockerfile | 61 ------- docker_images/ros/humble/regular/Dockerfile | 72 -------- docker_images/ros/humble/rvc3/Dockerfile | 84 --------- docker_images/rvc3/Dockerfile | 74 -------- dockerfiles/base.Dockerfile | 52 ++++++ dockerfiles/core.Dockerfile | 33 ++++ .../custom/rae-provisioning-app.Dockerfile | 39 ++++ .../custom/rvc3-builtin-app.Dockerfile | 36 ++++ .../libusb/libusb-LICENCE | 0 .../libusb}/linux_netlink.c | 0 pyproject.toml | 4 - scripts/build-images-base.sh | 71 ++++++++ scripts/build-images-core.sh | 18 ++ scripts/build-images-custom.sh | 44 +++++ scripts/build-images.sh | 137 +-------------- scripts/build-rvc3-image.sh | 126 ------------- scripts/launch-builders.sh | 24 --- scripts/make-manifests.sh | 29 +++ scripts/setup-remote-builder.sh | 41 ----- scripts/stop-builders.sh | 4 - 33 files changed, 541 insertions(+), 1100 deletions(-) delete mode 100644 .github/workflows/publish-base-images.yml create mode 100644 .github/workflows/publish-images.yml create mode 100644 .github/workflows/publish-patched-libusb.yml create mode 100755 context/download-patched-libusb create mode 100755 context/install-depthai-version create mode 100755 context/install-luxonis-packages create mode 100644 context/requirements-minimal.txt create mode 100644 context/requirements-regular.txt delete mode 100644 docker_images/minimal/Dockerfile delete mode 100644 docker_images/rae/builtin_app/Dockerfile delete mode 100644 docker_images/rae/provisioning_app/Dockerfile delete mode 100644 docker_images/regular/Dockerfile delete mode 100644 docker_images/ros/humble/minimal/Dockerfile delete mode 100644 docker_images/ros/humble/regular/Dockerfile delete mode 100644 docker_images/ros/humble/rvc3/Dockerfile delete mode 100644 docker_images/rvc3/Dockerfile create mode 100644 dockerfiles/base.Dockerfile create mode 100644 dockerfiles/core.Dockerfile create mode 100644 dockerfiles/custom/rae-provisioning-app.Dockerfile create mode 100644 dockerfiles/custom/rvc3-builtin-app.Dockerfile rename libusb-LICENCE => external/libusb/libusb-LICENCE (100%) rename {docker_images => external/libusb}/linux_netlink.c (100%) mode change 100644 => 100755 delete mode 100644 pyproject.toml create mode 100755 scripts/build-images-base.sh create mode 100755 scripts/build-images-core.sh create mode 100755 scripts/build-images-custom.sh delete mode 100755 scripts/build-rvc3-image.sh delete mode 100755 scripts/launch-builders.sh create mode 100755 scripts/make-manifests.sh delete mode 100755 scripts/setup-remote-builder.sh delete mode 100755 scripts/stop-builders.sh diff --git a/.github/workflows/publish-base-images.yml b/.github/workflows/publish-base-images.yml deleted file mode 100644 index cfc35c1..0000000 --- a/.github/workflows/publish-base-images.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Build and publish base images -concurrency: aws-worker - -on: - workflow_dispatch: - inputs: - depthaiBranch: - description: 'DepthAI Git branch' - required: true - type: string - - repository_dispatch: - types: [depthai-python-release, robothub-oak-release, depthai-sdk-release] - - push: - branches: - - main - - develop - paths: - - '.github/workflows/publish-base-images.yml' - - '**/*' - - '**/*' - -env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - AWS_X86_IMAGE_ID: ${{ secrets.AWS_X86_IMAGE_ID }} - AWS_ARM64_IMAGE_ID: ${{ secrets.AWS_ARM64_IMAGE_ID }} - AWS_DEFAULT_REGION: us-east-1 - DEPTHAI_BRANCH: ${{ github.event.inputs.depthaiBranch }} - EXTERNAL_TRIGGER_REF: ${{ github.event.client_payload.ref }} - -jobs: - build: - name: Build & push images - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - outputs: - x86_builder_id: ${{ steps.launch_instances.outputs.x86_builder_id }} - arm_builder_id: ${{ steps.launch_instances.outputs.arm_builder_id }} - steps: - - - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Launch instances - id: launch_instances - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} - run: | - ./scripts/launch-builders.sh - - - name: Build images - continue-on-error: true - env: - SSH_KEY: ${{ secrets.AWS_SSH_KEY }} - X86_BUILDER_IP: ${{ steps.launch_instances.outputs.x86_ip }} - ARM_BUILDER_IP: ${{ steps.launch_instances.outputs.arm_ip }} - run: | - ./scripts/setup-remote-builder.sh - ./scripts/build-images.sh - ./scripts/build-rvc3-image.sh - - - name: Terminate instances - if: ${{ always() && steps.launch_instances.outcome == 'success' }} - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} - AWS_X86_BUILDER_ID: ${{ steps.launch_instances.outputs.x86_builder_id }} - AWS_ARM_BUILDER_ID: ${{ steps.launch_instances.outputs.arm_builder_id }} - run: | - ./scripts/stop-builders.sh diff --git a/.github/workflows/publish-images.yml b/.github/workflows/publish-images.yml new file mode 100644 index 0000000..26404a0 --- /dev/null +++ b/.github/workflows/publish-images.yml @@ -0,0 +1,71 @@ +name: Build and publish images + +on: + workflow_dispatch: + release: + types: [published] + +env: + IMAGE_REF_NAME: ${{ github.event_name == 'release' && 'robothub-app-v2' || 'robothub-app-v2-dev' }} + +jobs: + generate-version: + name: Generate image version + runs-on: buildjet-2vcpu-ubuntu-2204 + outputs: + version: ${{ steps.generate-version.outputs.version }} + steps: + - name: Generate image version + id: generate-version + run: echo "version=$(date +%Y.%j.%H%M)" >> "$GITHUB_OUTPUT" + build: + name: Build & push images + permissions: + packages: write + contents: read + needs: generate-version + strategy: + fail-fast: false + matrix: + runner: + - { runs-on: buildjet-4vcpu-ubuntu-2204, arch: amd64 } + - { runs-on: buildjet-4vcpu-ubuntu-2204-arm, arch: arm64 } + env: + IMAGE_VERSION: ${{ needs.generate-version.outputs.version }} + ARCH: ${{ matrix.runner.arch }} + runs-on: ${{ matrix.runner.runs-on }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build & push images + run: ./scripts/build-images.sh + make-manifests: + name: Make multi-arch manifests + permissions: + packages: write + contents: read + needs: [generate-version, build] + env: + IMAGE_VERSION: ${{ needs.generate-version.outputs.version }} + runs-on: buildjet-2vcpu-ubuntu-2204 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Make multi-arch manifests + run: ./scripts/make-manifests.sh diff --git a/.github/workflows/publish-patched-libusb.yml b/.github/workflows/publish-patched-libusb.yml new file mode 100644 index 0000000..75ea1dd --- /dev/null +++ b/.github/workflows/publish-patched-libusb.yml @@ -0,0 +1,48 @@ +name: Build and publish patched libusb + +on: + workflow_dispatch: + +jobs: + build-libusb: + name: Build & publish patched libusb + timeout-minutes: 30 + permissions: + contents: read + strategy: + fail-fast: false + matrix: + runner: + - {runs-on: buildjet-2vcpu-ubuntu-2204, arch: x86_64} + - {runs-on: buildjet-2vcpu-ubuntu-2204-arm, arch: aarch64} + runs-on: ${{ matrix.runner.runs-on }} + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -qq --no-install-recommends ca-certificates wget bzip2 build-essential + - name: Build libusb + working-directory: external/libusb/ + run: | + wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 + tar xf libusb-1.0.26.tar.bz2 + cp linux_netlink.c libusb-1.0.26/libusb/os/linux_netlink.c + cd libusb-1.0.26 + ./configure --disable-udev + make -j$(nproc) + - name: Install aws cli + env: + ARCHITECTURE: ${{ matrix.runner.arch }} + run: | + wget -O "awscliv2.zip" "https://awscli.amazonaws.com/awscli-exe-linux-$ARCHITECTURE.zip" + unzip awscliv2.zip + sudo ./aws/install --update + - name: Upload to bucket + working-directory: external/libusb/ + env: + ARCHITECTURE: ${{ matrix.runner.arch }} + AWS_ACCESS_KEY_ID: ${{ secrets.RH_PUBLIC_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.RH_PUBLIC_SECRET_ACCESS_KEY }} + AWS_ENDPOINT_URL: ${{ secrets.RH_PUBLIC_ENDPOINT }} + run: aws s3 cp libusb-1.0.26/libusb/.libs/libusb-1.0.so.0.3.0 s3://rh-public/libusb/1.0.26/libusb-$ARCHITECTURE.so diff --git a/README.md b/README.md index c90677c..c7a594e 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,33 @@ -# RobotHub-Images Repository +# RobotHub Images Repository This repository contains the Dockerfiles used to build the images for RobotHub apps. ## Available Images -> **Note**: All images are available at [GitHub Packages](https://github.com/luxonis/robothub-images/pkgs/container/robothub-app-v2). -- minimal: Debian-based image with minimal dependencies for running RobotHub apps -- regular: Ubuntu-based image for running RobotHub apps (recommended) -- ros2humble: Ubuntu-based image for running RobotHub apps with ROS2 Humble installed + +> [!NOTE] +> All images are available at [GitHub Packages](https://github.com/luxonis/robothub-images/pkgs/container/robothub-app-v2). + +### Robotics Vision Core + +- `RVC2` ([OAK Series 2](https://docs.luxonis.com/projects/hardware/en/latest/pages/articles/oak-s2/)) +- `RVC3` ([OAK Series 3](https://docs.luxonis.com/projects/hardware/en/latest/pages/articles/oak-s3/)) + +### Variant + +- `minimal`: Ubuntu-based image with minimal dependencies for running RobotHub apps +- `regular`: Ubuntu-based image for running RobotHub apps (recommended) + +### ROS2 + +- `ros2humble`: Ubuntu-based image for running RobotHub apps with ROS2 Humble installed ## Making first app -Please visit [RobotHub documentation page](https://docs-beta.luxonis.com/robothub/get-started) for more information about how to make your +Please visit [RobotHub documentation page](https://docs-beta.luxonis.com/develop/quick-start) for more information about how to make your first app. ## License This project is licensed under the terms of the MIT license. -If you have any questions about Perception Apps or RobotHub, please visit our [Documentation](https://hub-docs.luxonis.com/docs/perception-apps/overview) or ask us directly on the [forums](https://discuss.luxonis.com). - +If you have any questions about Perception Apps or RobotHub, please visit our [Documentation](https://docs-beta.luxonis.com/) or ask us directly on the [forums](https://discuss.luxonis.com). diff --git a/context/download-patched-libusb b/context/download-patched-libusb new file mode 100755 index 0000000..ee9144d --- /dev/null +++ b/context/download-patched-libusb @@ -0,0 +1,22 @@ +#!/bin/bash + +TARGETARCH_LINUX="" +if [[ $# -eq 0 ]]; then + TARGETARCH_LINUX=$(uname -m) +elif [[ $# -eq 1 ]]; then + TARGETARCH=$1 + if [[ "${TARGETARCH}" == "amd64" ]]; then + TARGETARCH_LINUX="x86_64" + elif [[ "${TARGETARCH}" == "arm64" ]]; then + TARGETARCH_LINUX="aarch64" + else + echo "Unknown TARGETARCH: ${TARGETARCH}" + exit 1 + fi +else + echo "Usage: $0 [target-arch]" + echo "target-arch: amd64, arm64" + exit 1 +fi + +wget -O /lib/libusb-1.0.so "https://rh-public.luxonis.com/libusb/1.0.26/libusb-${TARGETARCH_LINUX}.so" diff --git a/context/install-depthai-version b/context/install-depthai-version new file mode 100755 index 0000000..f929230 --- /dev/null +++ b/context/install-depthai-version @@ -0,0 +1,14 @@ +#!/bin/bash + +if [[ $# -ne 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +DEPTHAI_VERSION=$1 + +echo "Installing depthai version: ${DEPTHAI_VERSION}" +pip3 install --no-deps --no-cache-dir --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai==${DEPTHAI_VERSION} + +echo "Patching depthai installation..." +find /usr/local/lib/python3.10/dist-packages/depthai.libs -type f -name "libusb*.so" -print -exec cp /lib/libusb-1.0.so {} \; diff --git a/context/install-luxonis-packages b/context/install-luxonis-packages new file mode 100755 index 0000000..77a2821 --- /dev/null +++ b/context/install-luxonis-packages @@ -0,0 +1,22 @@ +#!/bin/bash + +if [[ $# -ne 3 ]]; then + echo "Usage: $0 [robotics-vision-core] [depthai-sdk-version] [robothub-oak-version]" + echo "robotics-vision-core: rvc2, rvc3" + exit 1 +fi + +ROBOTICS_VISION_CORE=$1 +DEPTHAI_SDK_VERSION=$2 +ROBOTHUB_VERSION=$3 + +if [[ "$ROBOTICS_VISION_CORE" == "rvc2" ]]; then + pip3 install --no-deps --no-cache-dir depthai-sdk==${DEPTHAI_SDK_VERSION} + pip3 install --no-deps --no-cache-dir robothub==${ROBOTHUB_VERSION} +elif [[ "$ROBOTICS_VISION_CORE" == "rvc3" ]]; then + pip3 install --no-deps --no-cache-dir "git+https://github.com/luxonis/depthai.git@${DEPTHAI_SDK_VERSION}#subdirectory=depthai_sdk" + pip3 install --no-deps --no-cache-dir robothub==${ROBOTHUB_VERSION} +else + echo "Unknown ROBOTICS_VISION_CORE: ${ROBOTICS_VISION_CORE}" + exit 1 +fi diff --git a/context/requirements-minimal.txt b/context/requirements-minimal.txt new file mode 100644 index 0000000..6ceedb7 --- /dev/null +++ b/context/requirements-minimal.txt @@ -0,0 +1,7 @@ +distinctipy +marshmallow +numpy +opencv-contrib-python-headless +requests +sentry-sdk +xmltodict diff --git a/context/requirements-regular.txt b/context/requirements-regular.txt new file mode 100644 index 0000000..f846423 --- /dev/null +++ b/context/requirements-regular.txt @@ -0,0 +1,9 @@ +av +blobconverter +distinctipy +marshmallow +numpy +opencv-contrib-python-headless +requests +sentry-sdk +xmltodict diff --git a/docker_images/minimal/Dockerfile b/docker_images/minimal/Dockerfile deleted file mode 100644 index 1da8675..0000000 --- a/docker_images/minimal/Dockerfile +++ /dev/null @@ -1,166 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ubuntu:22.04 as origin - -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -ARG DEBIAN_FRONTEND=noninteractive -ARG OPENCV_VERSION=4.7.0 - -FROM origin as base - -# Install Python 3 -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends python3 python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -# Install dependencies for building depthai -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake python3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --recurse-submodules https://github.com/luxonis/depthai-python.git - -# Patch and build libusb -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# # Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir depthai_sdk && \ - pip3 install --no-cache-dir --only-binary=:all: sentry-sdk distinctipy requests numpy xmltodict marshmallow opencv-contrib-python-headless - -# Build OpenCV from source -# WORKDIR /opt/build - -# RUN set -ex \ -# && apt-get -qq update \ -# && apt-get -qq install -y --no-install-recommends \ -# build-essential cmake \ -# wget unzip \ -# libhdf5-103-1 libhdf5-dev \ -# libopenblas0 libopenblas-dev \ -# libprotobuf23 libprotobuf-dev \ -# libjpeg8 libjpeg8-dev \ -# libpng16-16 libpng-dev \ -# libtiff5 libtiff-dev \ -# libwebp7 libwebp-dev \ -# libopenjp2-7 libopenjp2-7-dev \ -# libtbb2 libtbb2-dev \ -# libeigen3-dev \ -# tesseract-ocr tesseract-ocr-por libtesseract-dev \ -# python3 python3-pip python3-numpy python3-dev \ -# && wget -q --no-check-certificate https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -O opencv.zip \ -# && wget -q --no-check-certificate https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -O opencv_contrib.zip \ -# && unzip -qq opencv.zip -d /opt && rm -rf opencv.zip \ -# && unzip -qq opencv_contrib.zip -d /opt && rm -rf opencv_contrib.zip \ -# && cmake \ -# -D CMAKE_BUILD_TYPE=RELEASE \ -# -D CMAKE_INSTALL_PREFIX=/usr/local \ -# -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib-${OPENCV_VERSION}/modules \ -# -D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \ -# -D OPENCV_ENABLE_NONFREE=ON \ -# -D WITH_JPEG=ON \ -# -D WITH_PNG=ON \ -# -D WITH_TIFF=ON \ -# -D WITH_WEBP=ON \ -# -D WITH_JASPER=ON \ -# -D WITH_EIGEN=ON \ -# -D WITH_TBB=ON \ -# -D WITH_LAPACK=ON \ -# -D WITH_PROTOBUF=ON \ -# -D WITH_V4L=OFF \ -# -D WITH_GSTREAMER=OFF \ -# -D WITH_GTK=OFF \ -# -D WITH_QT=OFF \ -# -D WITH_CUDA=OFF \ -# -D WITH_VTK=OFF \ -# -D WITH_OPENEXR=OFF \ -# -D WITH_FFMPEG=OFF \ -# -D WITH_OPENCL=OFF \ -# -D WITH_OPENNI=OFF \ -# -D WITH_XINE=OFF \ -# -D WITH_GDAL=OFF \ -# -D WITH_IPP=OFF \ -# -D BUILD_OPENCV_PYTHON3=ON \ -# -D BUILD_OPENCV_PYTHON2=OFF \ -# -D BUILD_OPENCV_JAVA=OFF \ -# -D BUILD_TESTS=OFF \ -# -D BUILD_IPP_IW=OFF \ -# -D BUILD_PERF_TESTS=OFF \ -# -D BUILD_EXAMPLES=OFF \ -# -D BUILD_ANDROID_EXAMPLES=OFF \ -# -D BUILD_DOCS=OFF \ -# -D BUILD_ITT=OFF \ -# -D INSTALL_PYTHON_EXAMPLES=OFF \ -# -D INSTALL_C_EXAMPLES=OFF \ -# -D INSTALL_TESTS=OFF \ -# /opt/opencv-${OPENCV_VERSION} \ -# && make -j$(nproc) -# RUN make install \ -# && ln -s /usr/local/lib/python3.10/dist-packages/cv2/python-3.10/cv2.cpython-310-x86_64-linux-gnu.so /usr/local/lib/python3.10/dist-packages/cv2/python-3.10/cv2.so \ -# # && rm -rf /opt/build/* \ -# # && rm -rf /opt/opencv-${OPENCV_VERSION} \ -# # && rm -rf /opt/opencv_contrib-${OPENCV_VERSION} \ -# && apt-get -qq remove -y \ -# software-properties-common \ -# build-essential cmake \ -# git wget bzip2 \ -# libhdf5-dev \ -# libprotobuf-dev \ -# libjpeg8-dev \ -# libpng-dev \ -# libtiff-dev \ -# libwebp-dev \ -# libopenjp2-7-dev \ -# libtbb-dev \ -# libtesseract-dev \ -# python3-dev \ -# && apt-get -qq autoremove \ -# && apt-get -qq clean - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/rae/builtin_app/Dockerfile b/docker_images/rae/builtin_app/Dockerfile deleted file mode 100644 index e3f73bb..0000000 --- a/docker_images/rae/builtin_app/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ubuntu:22.04 as origin - -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -ARG DEBIAN_FRONTEND=noninteractive -ARG OPENCV_VERSION=4.7.0 - -FROM origin as base - -# Install Python 3 -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends python3 python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake python3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --branch "rvc3_develop" --recurse-submodules https://github.com/luxonis/depthai-python.git - -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN pip3 install --no-cache-dir --only-binary=:all: numpy -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir git+https://github.com/luxonis/depthai.git@rvc3_develop#subdirectory=depthai_sdk - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/rae/provisioning_app/Dockerfile b/docker_images/rae/provisioning_app/Dockerfile deleted file mode 100644 index d067c3d..0000000 --- a/docker_images/rae/provisioning_app/Dockerfile +++ /dev/null @@ -1,71 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ubuntu:22.04 as origin - -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -ARG DEBIAN_FRONTEND=noninteractive -ARG OPENCV_VERSION=4.7.0 - -FROM origin as base - -# Install Python 3 -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends python3 python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake python3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --branch "rvc3_develop" --recurse-submodules https://github.com/luxonis/depthai-python.git - -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN pip3 install --no-cache-dir --only-binary=:all: numpy -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-cache-dir --only-binary=:all: opencv-contrib-python-headless - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/regular/Dockerfile b/docker_images/regular/Dockerfile deleted file mode 100644 index 34b011d..0000000 --- a/docker_images/regular/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ubuntu:22.04 as origin - -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -ARG DEBIAN_FRONTEND=noninteractive -ARG OPENCV_VERSION=4.7.0 - -FROM origin as base - -# Install Python 3 -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends python3 python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -# Install dependencies for building depthai -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake python3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --recurse-submodules https://github.com/luxonis/depthai-python.git - -# Patch and build libusb -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# # Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir depthai_sdk && \ - pip3 install --no-cache-dir --only-binary=:all: sentry-sdk requests numpy \ - xmltodict marshmallow opencv-contrib-python-headless av blobconverter - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/ros/humble/minimal/Dockerfile b/docker_images/ros/humble/minimal/Dockerfile deleted file mode 100644 index 0190055..0000000 --- a/docker_images/ros/humble/minimal/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ros:humble-ros-core as origin - -# Python will buffer output in case of non interactive terminals and we don't want that, because it delays logs -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends git ca-certificates wget python3-pip bzip2 build-essential cmake && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --recurse-submodules https://github.com/luxonis/depthai-python.git - -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir depthai_sdk && \ - pip3 install --no-cache-dir --only-binary=:all: sentry-sdk requests numpy \ - xmltodict marshmallow opencv-contrib-python-headless - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM ros:humble-ros-core - -# Squash the image to save on space -COPY --from=origin /opt/depthai /lib -COPY --from=origin /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=origin /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/ros/humble/regular/Dockerfile b/docker_images/ros/humble/regular/Dockerfile deleted file mode 100644 index b2c17de..0000000 --- a/docker_images/ros/humble/regular/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -FROM ros:humble-ros-base as origin - -# Python will buffer output in case of non interactive terminals and we don't want that, because it delays logs -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -FROM origin as base - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends python3-dev git ca-certificates wget bzip2 build-essential cmake && \ - rm -rf /var/lib/apt/lists/* - -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --recurse-submodules https://github.com/luxonis/depthai-python.git - -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir depthai_sdk && \ - pip3 install --no-cache-dir --only-binary=:all: sentry-sdk requests numpy \ - xmltodict marshmallow opencv-contrib-python-headless av blobconverter - - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/docker_images/ros/humble/rvc3/Dockerfile b/docker_images/ros/humble/rvc3/Dockerfile deleted file mode 100644 index 6cd9901..0000000 --- a/docker_images/ros/humble/rvc3/Dockerfile +++ /dev/null @@ -1,84 +0,0 @@ -FROM ros:humble-ros-base as origin - -# Set python environment variables -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -FROM origin as base - -# Install python 3.10 -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends python3-dev python3-pip && \ - rm -rf /var/lib/apt/lists/* && apt-get clean -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - -FROM base as build - -# Install build dependencies -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake && \ - rm -rf /var/lib/apt/lists/* && apt-get clean - -# Download libusb and depthai-python -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --branch "rvc3_develop" --recurse-submodules https://github.com/luxonis/depthai-python.git - -# Patch and build libusb -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -# Build depthai-python -RUN python3.10 -m pip install --no-cache-dir --only-binary=:all: numpy -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Copy dependencies to /opt/depthai -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -# Clear build dependencies -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so - -# Install opencv -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends python3-opencv - -# Install depthai-sdk -RUN git clone --depth=1 --branch "rvc3_develop" https://github.com/luxonis/depthai.git /tmp/depthai && \ - python3.10 -m pip install --no-deps --no-cache-dir /tmp/depthai/depthai_sdk && \ - rm -rf /tmp/depthai - -# Install python packages -RUN python3.10 -m pip install --no-deps --no-cache-dir opencv-contrib-python && \ - python3.10 -m pip install --no-deps --no-cache-dir robothub-oak && \ - python3.10 -m pip install --no-cache-dir --only-binary=:all: distinctipy requests numpy xmltodict marshmallow diff --git a/docker_images/rvc3/Dockerfile b/docker_images/rvc3/Dockerfile deleted file mode 100644 index f9b67d3..0000000 --- a/docker_images/rvc3/Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# syntax=docker/dockerfile:experimental -FROM ubuntu:22.04 as origin - -ENV PYTHONPATH=/lib \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 - -ARG DEBIAN_FRONTEND=noninteractive -ARG OPENCV_VERSION=4.7.0 - -FROM origin as base - -# Install Python 3 -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends python3 python3-pip && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -FROM base as build - -RUN apt-get update && \ - apt-get install -q -y --no-install-recommends git ca-certificates wget bzip2 build-essential cmake python3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean - -RUN wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 -O libusb.tar.bz2 && \ - git clone --depth=1 --branch "rvc3_develop" --recurse-submodules https://github.com/luxonis/depthai-python.git - -RUN wget -O /tmp/linux_netlink.c https://raw.githubusercontent.com/luxonis/robothub-images/main/docker_images/linux_netlink.c -RUN tar xf libusb.tar.bz2 \ - && cd libusb-* \ - && rm ./libusb/os/linux_netlink.c \ - && cp /tmp/linux_netlink.c ./libusb/os/linux_netlink.c \ - && ./configure --disable-udev \ - && make -j$(nproc) \ - && cp ./libusb/.libs/libusb-1.0.so.0.3.0 /tmp/libusb-1.0.so - -RUN pip3 install --no-cache-dir --only-binary=:all: numpy -RUN cd depthai-python \ - && cmake -H. -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_ENABLE_BACKWARD=OFF \ - && cmake --build build --parallel $(nproc) - -# Package dependencies -RUN mkdir -p /opt/depthai \ - && for dep in $(ldd /depthai-python/build/depthai*.so 2>/dev/null | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/'); do cp "$dep" /opt/depthai; done \ - && mv /depthai-python/build/depthai*.so /opt/depthai - -# Clear Python compiled artifacts -RUN find /usr -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ - \) -exec rm -rf '{}' + - -RUN pip3 install --no-deps --no-cache-dir robothub-oak && \ - pip3 install --no-deps --no-cache-dir git+https://github.com/luxonis/depthai.git@rvc3_develop#subdirectory=depthai_sdk && \ - pip3 install --no-cache-dir --only-binary=:all: sentry-sdk requests numpy \ - xmltodict marshmallow opencv-contrib-python-headless av blobconverter distinctipy - -RUN apt-get purge -y --auto-remove \ - build-essential \ - cmake \ - git \ - wget \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - -FROM base - -# Squash the image to save on space -COPY --from=build /opt/depthai /lib -COPY --from=build /tmp/libusb-1.0.so /lib/libusb-1.0.so -COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/dockerfiles/base.Dockerfile b/dockerfiles/base.Dockerfile new file mode 100644 index 0000000..eb7de67 --- /dev/null +++ b/dockerfiles/base.Dockerfile @@ -0,0 +1,52 @@ +ARG BASE_IMAGE + +FROM ${BASE_IMAGE} AS base + +ARG DEBIAN_FRONTEND=noninteractive + +ENV PYTHONPATH=/lib \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Install python3 +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* + +FROM base AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH +ARG ROBOTICS_VISION_CORE +ARG DEPTHAI_SDK_VERSION +ARG ROBOTHUB_VERSION +ARG VARIANT + +# Install dependencies +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends ca-certificates git wget && \ + rm -rf /var/lib/apt/lists/* + +# Download patched libusb +COPY download-patched-libusb /tmp/ +RUN /tmp/download-patched-libusb ${TARGETARCH} + +# Install luxonis packages +COPY install-luxonis-packages /tmp/ +RUN /tmp/install-luxonis-packages ${ROBOTICS_VISION_CORE} ${DEPTHAI_SDK_VERSION} ${ROBOTHUB_VERSION} + +# Install python3 packages +COPY requirements-${VARIANT}.txt /tmp/ +RUN pip3 install --no-cache-dir --only-binary=:all: -r /tmp/requirements-${VARIANT}.txt + +FROM base + +ARG DEPTHAI_VERSION + +# Copy python3 packages +COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages + +# Install depthai +COPY --from=build /lib/libusb-1.0.so /lib/libusb-1.0.so +COPY install-depthai-version /usr/local/bin +RUN install-depthai-version ${DEPTHAI_VERSION} diff --git a/dockerfiles/core.Dockerfile b/dockerfiles/core.Dockerfile new file mode 100644 index 0000000..ad5f18b --- /dev/null +++ b/dockerfiles/core.Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:22.04 AS base + +ARG DEBIAN_FRONTEND=noninteractive + +ENV PYTHONPATH=/lib \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Install python3 +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* + +FROM base AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH + +# Install dependencies +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends ca-certificates wget && \ + rm -rf /var/lib/apt/lists/* + +# Download patched libusb +COPY download-patched-libusb /tmp/ +RUN /tmp/download-patched-libusb ${TARGETARCH} + +FROM base + +# Copy libusb and scripts +COPY --from=build /lib/libusb-1.0.so /lib/libusb-1.0.so +COPY install-depthai-version /usr/local/bin +COPY install-luxonis-packages /usr/local/bin diff --git a/dockerfiles/custom/rae-provisioning-app.Dockerfile b/dockerfiles/custom/rae-provisioning-app.Dockerfile new file mode 100644 index 0000000..7540a43 --- /dev/null +++ b/dockerfiles/custom/rae-provisioning-app.Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:22.04 AS base + +ARG DEBIAN_FRONTEND=noninteractive + +ENV PYTHONPATH=/lib \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Install python3 +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* + +FROM base AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH +ARG DEPTHAI_VERSION + +# Install dependencies +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends ca-certificates wget && \ + rm -rf /var/lib/apt/lists/* + +# Download patched libusb +COPY download-patched-libusb /tmp/ +RUN /tmp/download-patched-libusb + +# Install depthai +COPY install-depthai-version /usr/local/bin +RUN install-depthai-version ${DEPTHAI_VERSION} + +# Install python3 packages +RUN pip3 install --no-cache-dir --only-binary=:all: opencv-contrib-python-headless + +FROM base + +# Copy python3 packages +COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/dockerfiles/custom/rvc3-builtin-app.Dockerfile b/dockerfiles/custom/rvc3-builtin-app.Dockerfile new file mode 100644 index 0000000..bfe11bc --- /dev/null +++ b/dockerfiles/custom/rvc3-builtin-app.Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:22.04 AS base + +ARG DEBIAN_FRONTEND=noninteractive + +ENV PYTHONPATH=/lib \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Install python3 +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* + +FROM base AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH +ARG DEPTHAI_VERSION + +# Install dependencies +RUN apt-get update -qq && \ + apt-get install -qq --no-install-recommends ca-certificates wget && \ + rm -rf /var/lib/apt/lists/* + +# Download patched libusb +COPY download-patched-libusb /tmp/ +RUN /tmp/download-patched-libusb ${TARGETARCH} + +# Install depthai +COPY install-depthai-version /usr/local/bin +RUN install-depthai-version ${DEPTHAI_VERSION} + +FROM base + +# Copy python3 packages +COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages diff --git a/libusb-LICENCE b/external/libusb/libusb-LICENCE similarity index 100% rename from libusb-LICENCE rename to external/libusb/libusb-LICENCE diff --git a/docker_images/linux_netlink.c b/external/libusb/linux_netlink.c old mode 100644 new mode 100755 similarity index 100% rename from docker_images/linux_netlink.c rename to external/libusb/linux_netlink.c diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 75f71a0..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,4 +0,0 @@ -[tool.black] -line-length = 180 -target-version = ['py39'] -include = '\.pyi?$' diff --git a/scripts/build-images-base.sh b/scripts/build-images-base.sh new file mode 100755 index 0000000..3730262 --- /dev/null +++ b/scripts/build-images-base.sh @@ -0,0 +1,71 @@ +#!/bin/bash +set -Eeux + +declare -a elems=( + "rvc2 ubuntu:22.04 minimal" + "rvc2 ubuntu:22.04 regular" + "rvc2 ros:humble-ros-core minimal" + "rvc2 ros:humble-ros-base regular" + "rvc3 ubuntu:22.04 minimal" + "rvc3 ubuntu:22.04 regular" + "rvc3 ros:humble-ros-core minimal" + "rvc3 ros:humble-ros-base regular" +) + +for elem in "${elems[@]}"; do + # Define base parameters + read -a strarr <<<"$elem" + ROBOTICS_VISION_CORE=${strarr[0]} + BASE_IMAGE=${strarr[1]} + VARIANT=${strarr[2]} + + # Derive remaining parameters + DEPTHAI_VERSION="" + DEPTHAI_SDK_VERSION="" + if [[ "${ROBOTICS_VISION_CORE}" == "rvc2" ]]; then + DEPTHAI_VERSION="2.22.0.0.dev0+4f65e787340f0c83f8c03619d240bbb8af1260df" + DEPTHAI_SDK_VERSION="1.12.1" + elif [[ "${ROBOTICS_VISION_CORE}" == "rvc3" ]]; then + DEPTHAI_VERSION="2.22.0.0.dev0+8b9eceb316ce60d57d9157ecec48534b548e8904" + DEPTHAI_SDK_VERSION="d188eec84fded7ea10a3dc124db7da433a2a3578" + else + echo "Unknown ROBOTICS_VISION_CORE: ${ROBOTICS_VISION_CORE}" + continue + fi + ROBOTHUB_VERSION="2.2.0" + + TAG="${BASE_TAG}-${ROBOTICS_VISION_CORE}-${VARIANT}" + if [[ "${BASE_IMAGE}" == "ros:humble-ros-core" || "${BASE_IMAGE}" == "ros:humble-ros-base" ]]; then + TAG="${TAG}-ros2humble" + fi + + # Build + echo "================================" + echo "Building '${TAG}'..." + echo "=> Depthai version: ${DEPTHAI_VERSION}" + echo "=> Depthai SDK version: ${DEPTHAI_SDK_VERSION}" + echo "=> RobotHub version: ${ROBOTHUB_VERSION}" + echo "================================" + + docker buildx build \ + --build-arg "BASE_IMAGE=${BASE_IMAGE}" \ + --build-arg "ROBOTICS_VISION_CORE=${ROBOTICS_VISION_CORE}" \ + --build-arg "DEPTHAI_VERSION=${DEPTHAI_VERSION}" \ + --build-arg "DEPTHAI_SDK_VERSION=${DEPTHAI_SDK_VERSION}" \ + --build-arg "ROBOTHUB_VERSION=${ROBOTHUB_VERSION}" \ + --build-arg "VARIANT=${VARIANT}" \ + --label "org.opencontainers.image.source=https://github.com/luxonis/robothub-images" \ + --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ + --label "org.opencontainers.image.vendor=Luxonis" \ + --label "org.opencontainers.image.ref.name=${IMAGE_REF_NAME}" \ + --label "org.opencontainers.image.title=RobotHub App base image" \ + --label "org.opencontainers.image.description=DepthAI version: ${DEPTHAI_VERSION}" \ + --label "com.luxonis.rh.depthai.version=${DEPTHAI_VERSION}" \ + --label "com.luxonis.rh.depthai-sdk.version=${DEPTHAI_SDK_VERSION}" \ + --label "com.luxonis.rh.robothub.version=${ROBOTHUB_VERSION}" \ + --tag "${TAG}" \ + --push \ + --provenance=false \ + --file dockerfiles/base.Dockerfile \ + context/ +done diff --git a/scripts/build-images-core.sh b/scripts/build-images-core.sh new file mode 100755 index 0000000..3294757 --- /dev/null +++ b/scripts/build-images-core.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -Eeux + +CORE_TAG="${BASE_TAG}-core" +echo "================================" +echo "Building '${CORE_TAG}'..." +echo "================================" +docker buildx build \ + --label "org.opencontainers.image.source=https://github.com/luxonis/robothub-images" \ + --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ + --label "org.opencontainers.image.vendor=Luxonis" \ + --label "org.opencontainers.image.ref.name=${IMAGE_REF_NAME}" \ + --label "org.opencontainers.image.title=RobotHub App core image" \ + --tag "${CORE_TAG}" \ + --push \ + --provenance=false \ + --file dockerfiles/core.Dockerfile \ + context/ diff --git a/scripts/build-images-custom.sh b/scripts/build-images-custom.sh new file mode 100755 index 0000000..302e39c --- /dev/null +++ b/scripts/build-images-custom.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -Eeux + +DEPTHAI_VERSION="2.22.0.0.dev0+8b9eceb316ce60d57d9157ecec48534b548e8904" + +RVC3_BUILTIN_APP_TAG="${BASE_TAG}-rvc3-builtin-app" +echo "================================" +echo "Building '${RVC3_BUILTIN_APP_TAG}'..." +echo "=> Depthai version: ${DEPTHAI_VERSION}" +echo "================================" +docker buildx build \ + --build-arg "DEPTHAI_VERSION=${DEPTHAI_VERSION}" \ + --label "org.opencontainers.image.source=https://github.com/luxonis/robothub-images" \ + --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ + --label "org.opencontainers.image.vendor=Luxonis" \ + --label "org.opencontainers.image.ref.name=${IMAGE_REF_NAME}" \ + --label "org.opencontainers.image.title=RobotHub RVC3 builtin app image" \ + --label "org.opencontainers.image.description=DepthAI version: ${DEPTHAI_VERSION}" \ + --label "com.luxonis.rh.depthai.version=${DEPTHAI_VERSION}" \ + --tag "${RVC3_BUILTIN_APP_TAG}" \ + --push \ + --provenance=false \ + --file dockerfiles/custom/rvc3-builtin-app.Dockerfile \ + context/ + +RAE_PROVISIONING_APP_TAG="${BASE_TAG}-rae-provisioning-app" +echo "================================" +echo "Building '${RAE_PROVISIONING_APP_TAG}'..." +echo "=> Depthai version: ${DEPTHAI_VERSION}" +echo "================================" +docker buildx build \ + --build-arg "DEPTHAI_VERSION=${DEPTHAI_VERSION}" \ + --label "org.opencontainers.image.source=https://github.com/luxonis/robothub-images" \ + --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ + --label "org.opencontainers.image.vendor=Luxonis" \ + --label "org.opencontainers.image.ref.name=${IMAGE_REF_NAME}" \ + --label "org.opencontainers.image.title=RobotHub RAE provisioning app image" \ + --label "org.opencontainers.image.description=DepthAI version: ${DEPTHAI_VERSION}" \ + --label "com.luxonis.rh.depthai.version=${DEPTHAI_VERSION}" \ + --tag "${RAE_PROVISIONING_APP_TAG}" \ + --push \ + --provenance=false \ + --file dockerfiles/custom/rae-provisioning-app.Dockerfile \ + context/ diff --git a/scripts/build-images.sh b/scripts/build-images.sh index 9a1d721..b74db58 100755 --- a/scripts/build-images.sh +++ b/scripts/build-images.sh @@ -1,135 +1,10 @@ #!/bin/bash set -Eeux -TAG_SUFFIX="" +export BASE_PACKAGE="ghcr.io/luxonis/${IMAGE_REF_NAME}-${ARCH}" +export BASE_TAG="${BASE_PACKAGE}:${IMAGE_VERSION}" +export DOCKER_BUILDKIT=1 -if [[ -n "${EXTERNAL_TRIGGER_REF}" ]]; then - DEPTHAI_BRANCH="${EXTERNAL_TRIGGER_REF##*/}" -elif [[ -z "${DEPTHAI_BRANCH}" ]]; then - DEPTHAI_BRANCH="main" -else - TAG_SUFFIX="${TAG_SUFFIX}-custom" -fi - -if [[ "$GITHUB_REF_NAME" != "main" ]]; then - TAG_SUFFIX="${TAG_SUFFIX}-dev" -fi - -IMAGE_VERSION=$(date +"%Y.%j.%H%M") - -if [[ "$DEPTHAI_BRANCH" != "main" ]]; then - DEPTHAI_VERSION=$DEPTHAI_BRANCH -else - git clone --depth=1 --recurse-submodules --branch "${DEPTHAI_BRANCH}" https://github.com/luxonis/depthai-python.git .depthai - cd .depthai - DEPTHAI_VERSION=$(python3 -c 'import find_version as v; print(v.get_package_version()); exit(0);') - DEPTHAI_VERSION="v"$DEPTHAI_VERSION - cd .. -fi - -BASE_PACKAGE="ghcr.io/luxonis/robothub-app-v2" -BASE_TAG="${BASE_PACKAGE}:${IMAGE_VERSION}" - -BASE_MINIMAL_TAG="${BASE_TAG}-minimal${TAG_SUFFIX}" -BASE_REGULAR_TAG="${BASE_TAG}-regular${TAG_SUFFIX}" -ROS_HUMBLE_MINIMAL_TAG="${BASE_TAG}-ros2humble-minimal${TAG_SUFFIX}" -ROS_HUMBLE_REGULAR_TAG="${BASE_TAG}-ros2humble-regular${TAG_SUFFIX}" - -echo "================================" -echo "Building images..." -echo "DEPTHAI_VERSION=${DEPTHAI_VERSION}" -echo "================================" - -echo "================================" -echo "Building minimal..." -echo "=> ${BASE_MINIMAL_TAG}" -echo "================================" -# Minimal -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=python3.10-slim-bullseye" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception App Base" \ - --label "org.opencontainers.image.description=Based on: Debian\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${BASE_MINIMAL_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/minimal/Dockerfile \ - ./ - -echo "================================" -echo "Building regular..." -echo "=> ${BASE_REGULAR_TAG}" -echo "================================" -# Regular -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ubuntu22.04" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception App Base" \ - --label "org.opencontainers.image.description=Based on: Ubuntu\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${BASE_REGULAR_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/regular/Dockerfile \ - ./ - -echo "================================" -echo "Building ros2humble minimal..." -echo "=> ${ROS_HUMBLE_MINIMAL_TAG}" -echo "================================" - -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/arm64,linux/amd64 \ - --build-arg "ROS_VERSION_TAG=humble-ros-base-jammy" \ - --build-arg "DEPTHAI_VERSION=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ros2/humble" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception App Base" \ - --label "org.opencontainers.image.description=Based on: ROS-humble/Ubuntu-22.04\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${ROS_HUMBLE_MINIMAL_TAG}" \ - --push \ - --file ./docker_images/ros/humble/minimal/Dockerfile \ - ./ - -echo "================================" -echo "Building ros2humble regular..." -echo "=> ${ROS_HUMBLE_REGULAR_TAG}" -echo "================================" - -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/arm64,linux/amd64 \ - --build-arg "ROS_VERSION_TAG=humble-ros-base-jammy" \ - --build-arg "DEPTHAI_VERSION=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ros2/humble" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception App Base" \ - --label "org.opencontainers.image.description=Based on: ROS-humble/Ubuntu-22.04\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${ROS_HUMBLE_REGULAR_TAG}" \ - --push \ - --file ./docker_images/ros/humble/regular/Dockerfile \ - ./ - -echo "================================" -echo "All done!" -echo "================================" +./scripts/build-images-core.sh +./scripts/build-images-base.sh +./scripts/build-images-custom.sh diff --git a/scripts/build-rvc3-image.sh b/scripts/build-rvc3-image.sh deleted file mode 100755 index 134394f..0000000 --- a/scripts/build-rvc3-image.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -set -Eeux - -TAG_SUFFIX="" - -DEPTHAI_BRANCH="rvc3_develop" - -if [[ "$GITHUB_REF_NAME" != "main" ]]; then - TAG_SUFFIX="${TAG_SUFFIX}-dev" -fi - -IMAGE_VERSION=$(date +"%Y.%j.%H%M") - -if [[ "$DEPTHAI_BRANCH" != "main" ]]; then - DEPTHAI_VERSION=$DEPTHAI_BRANCH -else - git clone --depth=1 --recurse-submodules --branch "${DEPTHAI_BRANCH}" https://github.com/luxonis/depthai-python.git .depthai - cd .depthai - DEPTHAI_VERSION=$(python3 -c 'import find_version as v; print(v.get_package_version()); exit(0);') - DEPTHAI_VERSION="v"$DEPTHAI_VERSION - cd .. -fi - -BASE_PACKAGE="ghcr.io/luxonis/robothub-app-v2" -BASE_TAG="${BASE_PACKAGE}:${IMAGE_VERSION}" -BASE_RVC3_TAG="${BASE_TAG}-rvc3${TAG_SUFFIX}" -BASE_ROS2HUMBLE_RVC3_TAG="${BASE_TAG}-ros2humble-rvc3${TAG_SUFFIX}" -RAE_PROV_TAG="${BASE_TAG}-rae-provisioning${TAG_SUFFIX}" -RAE_BUILTIN_TAG="${BASE_TAG}-rae-builtin${TAG_SUFFIX}" - -echo "================================" -echo "Building images..." -echo "DEPTHAI_VERSION=${DEPTHAI_VERSION}" -echo "================================" - -echo "================================" -echo "Building minimal..." -echo "=> ${BASE_RVC3_TAG}" -echo "================================" -# Minimal -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=python3.10-slim-bullseye" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception RVC3 App Base" \ - --label "org.opencontainers.image.description=Based on: Ubuntu\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${BASE_RVC3_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/rvc3/Dockerfile \ - ./ - -echo "================================" -echo "Building ROS Humble..." -echo "=> ${BASE_ROS2HUMBLE_RVC3_TAG}" -echo "================================" -# Minimal -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ros:humble-ros-base" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub Perception ROS2 Humble RVC3 App Base" \ - --label "org.opencontainers.image.description=Based on: Ubuntu\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${BASE_ROS2HUMBLE_RVC3_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/ros/humble/rvc3/Dockerfile \ - ./ - -echo "================================" -echo "Building RAE..." -echo "=> ${RAE_PROV_TAG}" -echo "================================" - -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ubuntu22.04" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub RAE provisioning app image" \ - --label "org.opencontainers.image.description=Based on: Ubuntu\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${RAE_PROV_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/rae/provisioning_app/Dockerfile \ - ./ - -echo "================================" -echo "Building RAE..." -echo "=> ${RAE_BUILTIN_TAG}" -echo "================================" - -DOCKER_BUILDKIT=1 docker buildx \ - build \ - --builder remotebuilder \ - --platform linux/amd64,linux/arm64 \ - --label "com.luxonis.rh.depthai=${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.branch=${DEPTHAI_BRANCH}" \ - --label "com.luxonis.rh.base=ubuntu22.04" \ - --label "org.opencontainers.image.version=${IMAGE_VERSION}" \ - --label "org.opencontainers.image.vendor=Luxonis" \ - --label "org.opencontainers.image.title=RobotHub RAE builtin app image" \ - --label "org.opencontainers.image.description=Based on: Ubuntu\nDepthAI branch: ${DEPTHAI_BRANCH}\nDepthAI version: ${DEPTHAI_VERSION}" \ - -t "${RAE_BUILTIN_TAG}" \ - --push \ - --provenance=false \ - --file ./docker_images/rae/builtin_app/Dockerfile \ - ./ - -echo "================================" -echo "All done!" -echo "================================" diff --git a/scripts/launch-builders.sh b/scripts/launch-builders.sh deleted file mode 100755 index 9ac39ea..0000000 --- a/scripts/launch-builders.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -Eeuo pipefail - -curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" -unzip awscliv2.zip -sudo ./aws/install --update - -x86Builder=$(aws ec2 run-instances --image-id ${AWS_X86_IMAGE_ID} --count 1 --instance-type c5.4xlarge --key-name docker-builder --security-group-ids sg-06ac69d4db0cb10ac --instance-market-options '{ "MarketType": "spot" }' | jq -r .Instances[0]) -armBuilder=$(aws ec2 run-instances --image-id ${AWS_ARM64_IMAGE_ID} --count 1 --instance-type a1.4xlarge --key-name docker-builder --security-group-ids sg-06ac69d4db0cb10ac --instance-market-options '{ "MarketType": "spot" }' | jq -r .Instances[0]) - -x86BuilderId=$(echo $x86Builder | jq -r .InstanceId) -armBuilderId=$(echo $armBuilder | jq -r .InstanceId) -echo "::set-output name=x86_builder_id::${x86BuilderId}" -echo "::set-output name=arm_builder_id::${armBuilderId}" - -aws ec2 wait instance-status-ok --instance-ids "${armBuilderId}" "${x86BuilderId}" - -x86Ip=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" "Name=instance-id,Values=${x86BuilderId}" --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text) -armIp=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" "Name=instance-id,Values=${armBuilderId}" --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text) -echo "::set-output name=x86_ip::${x86Ip}" -echo "::set-output name=arm_ip::${armIp}" - -echo "started x86: ${x86BuilderId} | ${x86Ip}" -echo "started ARM: ${armBuilderId} | ${armIp}" \ No newline at end of file diff --git a/scripts/make-manifests.sh b/scripts/make-manifests.sh new file mode 100755 index 0000000..851dd8a --- /dev/null +++ b/scripts/make-manifests.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -Eeux + +BASE_AMD64_TAG="ghcr.io/luxonis/${IMAGE_REF_NAME}-amd64:${IMAGE_VERSION}" +BASE_ARM64_TAG="ghcr.io/luxonis/${IMAGE_REF_NAME}-arm64:${IMAGE_VERSION}" +BASE_TAG="ghcr.io/luxonis/${IMAGE_REF_NAME}:${IMAGE_VERSION}" + +# Define suffixes +declare -a suffixes=( + "core" + "rvc2-minimal" + "rvc2-regular" + "rvc2-minimal-ros2humble" + "rvc2-regular-ros2humble" + "rvc3-minimal" + "rvc3-regular" + "rvc3-minimal-ros2humble" + "rvc3-regular-ros2humble" + "rvc3-builtin-app" + "rae-provisioning-app" +) + +# Make manifests +for suffix in "${suffixes[@]}"; do + docker buildx imagetools create \ + --tag "${BASE_TAG}-${suffix}" \ + "${BASE_AMD64_TAG}-${suffix}" \ + "${BASE_ARM64_TAG}-${suffix}" +done diff --git a/scripts/setup-remote-builder.sh b/scripts/setup-remote-builder.sh deleted file mode 100755 index 88d2d6f..0000000 --- a/scripts/setup-remote-builder.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -Eeuo pipefail - -mkdir -p ~/.ssh/ -touch ~/.ssh/aws_key -echo "${SSH_KEY}" > ~/.ssh/aws_key -chmod 600 ~/.ssh/aws_key -eval $(ssh-agent) -ssh-add ~/.ssh/aws_key - -touch ~/.ssh/config -echo "Host ${X86_BUILDER_IP}" >> ~/.ssh/config -echo " HostName ${X86_BUILDER_IP}" >> ~/.ssh/config -echo " User ubuntu" >> ~/.ssh/config -echo " StrictHostKeyChecking no" >> ~/.ssh/config -echo " IdentityFile /home/runner/.ssh/aws_key" >> ~/.ssh/config -echo "Host ${ARM_BUILDER_IP}" >> ~/.ssh/config -echo " HostName ${ARM_BUILDER_IP}" >> ~/.ssh/config -echo " User ubuntu" >> ~/.ssh/config -echo " StrictHostKeyChecking no" >> ~/.ssh/config -echo " IdentityFile /home/runner/.ssh/aws_key" >> ~/.ssh/config - -echo "configuring X86 builder at ${X86_BUILDER_IP}" -docker buildx create \ - --name remotebuilder \ - --node amd64 \ - --platform linux/amd64,linux/386 \ - --driver=docker-container \ - "ssh://ubuntu@${X86_BUILDER_IP}" - -echo "configuring ARM builder at ${ARM_BUILDER_IP}" -docker buildx create \ - --name remotebuilder \ - --append \ - --node arm64 \ - --platform linux/arm64,linux/arm/v7,linux/arm/v6 \ - --driver=docker-container \ - "ssh://ubuntu@${ARM_BUILDER_IP}" - -docker buildx inspect --bootstrap --builder remotebuilder diff --git a/scripts/stop-builders.sh b/scripts/stop-builders.sh deleted file mode 100755 index 2de6ada..0000000 --- a/scripts/stop-builders.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -Eeuo pipefail - -aws ec2 terminate-instances --instance-ids "${AWS_X86_BUILDER_ID}" "${AWS_ARM_BUILDER_ID}" \ No newline at end of file