diff --git a/README.md b/README.md index c7a594e..9cb1481 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ This repository contains the Dockerfiles used to build the images for RobotHub apps. +## Table of Contents + +- [Available Images](#available-images) +- [Building Images](#building-images) + - [Scripts Overview](#scripts-overview) + - [Using the Scripts](#using-the-scripts) + - [Configuration: versions.conf](#configuration-versionsconf) + - [Dockerfiles](#dockerfiles) + - [Additional Scripts and Utilities](#additional-scripts-and-utilities) +- [Automated Workflow](#automated-workflow) + - [Workflow Triggers](#workflow-triggers) + - [Key Jobs](#key-jobs) +- [Making first app](#making-first-app) +- [License](#license) + ## Available Images > [!NOTE] @@ -21,9 +36,123 @@ This repository contains the Dockerfiles used to build the images for RobotHub a - `ros2humble`: Ubuntu-based image for running RobotHub apps with ROS2 Humble installed + +## Building Images + +The `scripts` directory contains the scripts used to build and publish the images. + +```bash +scripts +├── build-images-base.sh +├── build-images-core.sh +├── build-images-custom.sh +├── build-images.sh +├── make-manifests.sh +└── versions.conf +``` + +### Scripts Overview + +The build process is powered by a collection of scripts, each serving a unique purpose: + +- `build-images.sh`: The main script that orchestrates the build process. +- `build-images-base.sh`: Focuses on different robot vision cores (RVCs) images based on the base image stored in: + - `dockerfiles/base.Dockerfile` + - `dockerfiles/depthai-v3-git/base.Dockerfile` +- `build-images-core.sh`: Builds images for core image stored in `dockerfiles/core.Dockerfile`. +- `build-images-custom.sh`: For custom application images (builtin-apps) stored in: + - `dockerfiles/custom/builtin-app.Dockerfile` + - `dockerfiles/custom/rae-provisioning-app.Dockerfile` + - `dockerfiles/depthai-v3-git/builtin-app.Dockerfile` +- `make-manifests.sh`: Handles the creation of multi-arch manifests. + +### Using the Scripts + +The `build-images.sh` script is the primary script that orchestrates the build process. It calls other scripts to construct the images. For local testing, `build-images.sh` can be executed directly from the command line. To run this script locally, you must have `docker` installed. + +To perform a local build without pushing the images to a registry, you should comment out the `push` command in the bash scripts. This prevents the images from being uploaded, allowing you to test the build process and images locally. + +```bash +export ARCH=amd64 # or arm64 +export IMAGE_REF_NAME=robothub-app-v2 # or robothub-app-v2-dev +export IMAGE_VERSION=$(date +%Y.%j.%H%M) + +./scripts/build-images.sh +``` + +### Configuration: `versions.conf` + +The `versions.conf` file is used to manage and specify the versions of dependencies for different Robotics Vision Core (RVC) devices within the RobotHub Images project. + +To update or change the version of `depthai` or any other dependency for a specific RVC device, modify the corresponding entry in the `versions.conf` file. + +Each line in `versions.conf` specifies a device identifier followed by the versions of its dependencies, separated by commas. The general format is: +```bash +=, +``` + +### Dockerfiles + +The `dockerfiles` directory contains the Dockerfiles used to build the images. + +```bash +dockerfiles +├── base.Dockerfile +├── core.Dockerfile +├── custom +│   ├── builtin-app.Dockerfile +│   └── rae-provisioning-app.Dockerfile +└── depthai-v3-git + ├── base.Dockerfile + └── builtin-app.Dockerfile +``` + +### Additional Scripts and Utilities + +The `context` directory also contains additional scripts and utilities used to support the build process. + +```bash +context +├── download-patched-libusb +├── install-depthai-from-git +├── install-depthai-version +├── install-luxonis-packages +├── requirements-builtin-app.txt +├── requirements-minimal.txt +├── requirements-rae-provisioning-app.txt +└── requirements-regular.txt + +``` + +## Automated Workflow + +The GitHub Actions workflow `publish-images.yml` orchestrates the build and publish process, utilizing scripts to generate different Docker images. + +### Workflow Triggers +The workflow is configured with two triggers that influence the naming convention of the docker images: + +- **Manual (`workflow_dispatch`)**: Initiates an on-demand build process. + - Images built from manual triggers are tagged with `dev` in their names, designated as `robothub-app-v2-dev`, indicating development versions. + - To trigger a manual build: + - navigate to the [Actions](https://github.com/luxonis/robothub-images/actions/workflows/publish-images.yml) tab + - click the `Run workflow` button + - select a branch to build from (e.g. `main`) + - click the `Run workflow` button to initiate the build process + + +- **Release (`release`)**: Automatically triggered when a new release is published. + - Release-triggered builds are tagged as `robothub-app-v2`, representing stable, production-ready versions. + +### Key Jobs + +1. **Generate Image Version**: Dynamically creates a version tag for the images from the build date and time. +2. **Build & Push Images**: Leverages multiple scripts to build images for different architectures and pushes them to GitHub Packages. +3. **Make Multi-Arch Manifests**: Consolidates images into multi-architecture manifests, facilitating platform-agnostic pulls. + + ## Making first app -Please visit [RobotHub documentation page](https://docs-beta.luxonis.com/develop/quick-start) for more information about how to make your +Please visit [RobotHub documentation page](https://docs-beta.luxonis.com/develop/prepare-env/) for more information about how to make your first app. ## License diff --git a/context/install-depthai-from-git b/context/install-depthai-from-git new file mode 100755 index 0000000..e1ac5d4 --- /dev/null +++ b/context/install-depthai-from-git @@ -0,0 +1,51 @@ +#!/bin/bash +set -Eeux + +# Check if the correct number of arguments is provided +if [[ $# -ne 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +DEPTHAI_GIT_VERSION=$1 +echo "Received DepthAI Git version: $DEPTHAI_GIT_VERSION" + +# Verify that the version starts with 'git+' +if [[ $DEPTHAI_GIT_VERSION != git+* ]]; then + echo "Error: DepthAI version must be a Git URL" + exit 1 +fi + +# Install necessary build tools and dependencies for compiling the DepthAI Python package from source +apt-get update -qq && \ +apt-get install -qq --no-install-recommends \ +python3 python3-dev python3-pip \ +ca-certificates \ +git \ +wget \ +cmake \ +make \ +build-essential && \ +pip3 install mypy && \ +rm -rf /var/lib/apt/lists/* + +# Parse the Git URL and Branch from the version string +GIT_URL=${DEPTHAI_GIT_VERSION/git+/} +BRANCH=${GIT_URL##*@} +GIT_URL=${GIT_URL%@*} +echo "Cloning from Git URL: $GIT_URL, Branch: $BRANCH" + + +# Clone the DepthAI Git repository +echo "Cloning DepthAI from Git..." +git clone --branch "$BRANCH" --recurse-submodules "$GIT_URL" depthai-python || { echo "Git clone failed"; exit 1; } + +# Navigate to the cloned directory +echo "Navigating to cloned directory..." +cd depthai-python || { echo "Failed to enter depthai-python directory"; exit 1; } + +# Build and install the package +echo "Building and installing the DepthAI package..." +pip3 install . --verbose || { echo "DepthAI installation failed"; exit 1; } + +echo "DepthAI installation from Git completed successfully." diff --git a/context/install-depthai-version b/context/install-depthai-version index f929230..6b1b2f1 100755 --- a/context/install-depthai-version +++ b/context/install-depthai-version @@ -8,7 +8,7 @@ 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} +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 index 15e226b..6c10e6c 100755 --- a/context/install-luxonis-packages +++ b/context/install-luxonis-packages @@ -1,21 +1,24 @@ #!/bin/bash +# Check for correct number of arguments if [[ $# -ne 3 ]]; then - echo "Usage: $0 [robotics-vision-core] [depthai-sdk-version] [robothub-version]" - echo "robotics-vision-core: rvc2, rvc3" + echo "Usage: $0 " + echo "robotics-vision-core: rvc2, rvc3, rvc2-depthaiV3" exit 1 fi ROBOTICS_VISION_CORE=$1 -DEPTHAI_SDK_VERSION=$2 -ROBOTHUB_VERSION=$3 +ROBOTHUB_VERSION=$2 +DEPTHAI_SDK_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} +# Install robothub +pip3 install --no-deps --no-cache-dir "robothub==${ROBOTHUB_VERSION}" + +# Install depthai-sdk based on the robotics-vision-core +if [[ "$ROBOTICS_VISION_CORE" == "rvc2" || "$ROBOTICS_VISION_CORE" == "rvc2-depthaiV3" ]]; then + pip3 install --no-deps --no-cache-dir "depthai-sdk==${DEPTHAI_SDK_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 diff --git a/dockerfiles/base.Dockerfile b/dockerfiles/base.Dockerfile index eb7de67..9fb6194 100644 --- a/dockerfiles/base.Dockerfile +++ b/dockerfiles/base.Dockerfile @@ -33,7 +33,7 @@ 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} +RUN /tmp/install-luxonis-packages ${ROBOTICS_VISION_CORE} ${ROBOTHUB_VERSION} ${DEPTHAI_SDK_VERSION} # Install python3 packages COPY requirements-${VARIANT}.txt /tmp/ @@ -49,4 +49,5 @@ COPY --from=build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3 # 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/depthai-v3-git/base.Dockerfile b/dockerfiles/depthai-v3-git/base.Dockerfile new file mode 100644 index 0000000..0e72160 --- /dev/null +++ b/dockerfiles/depthai-v3-git/base.Dockerfile @@ -0,0 +1,50 @@ +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 DEPTHAI_VERSION +ARG ROBOTICS_VISION_CORE +ARG DEPTHAI_VERSION +ARG DEPTHAI_SDK_VERSION +ARG ROBOTHUB_VERSION +ARG VARIANT + +COPY install-depthai-from-git /tmp/ +RUN /tmp/install-depthai-from-git ${DEPTHAI_VERSION} + +# Download patched libusb +COPY download-patched-libusb /tmp/ +RUN /tmp/download-patched-libusb ${TARGETARCH} + +# Install luxonis packages: depthai-sdk, robothub +COPY install-luxonis-packages /tmp/ +RUN /tmp/install-luxonis-packages ${ROBOTICS_VISION_CORE} ${ROBOTHUB_VERSION} ${DEPTHAI_SDK_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 diff --git a/dockerfiles/depthai-v3-git/builtin-app.Dockerfile b/dockerfiles/depthai-v3-git/builtin-app.Dockerfile new file mode 100644 index 0000000..ada4a81 --- /dev/null +++ b/dockerfiles/depthai-v3-git/builtin-app.Dockerfile @@ -0,0 +1,40 @@ +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-from-git /usr/local/bin +RUN install-depthai-from-git ${DEPTHAI_VERSION} + +# Install python3 packages +COPY requirements-builtin-app.txt /tmp/ +RUN pip3 install --no-cache-dir --only-binary=:all: -r /tmp/requirements-builtin-app.txt + +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/scripts/build-images-base.sh b/scripts/build-images-base.sh index 92bab94..f1df525 100755 --- a/scripts/build-images-base.sh +++ b/scripts/build-images-base.sh @@ -1,71 +1,105 @@ #!/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" -) +declare -A versions +CONFIG_FILE="scripts/versions.conf" +if [ ! -f "${CONFIG_FILE}" ]; then + echo "The file ${CONFIG_FILE} does not exist." + exit 1 +fi -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 +echo "Reading versions from ${CONFIG_FILE}..." +while IFS='=' read -r key value; do + versions[$key]=$value +done < "${CONFIG_FILE}" + +# Define base parameters +ROBOTHUB_VERSION="2.4.0" + +build_and_push_image() { + local robotics_vision_core=$1 + local base_image=$2 + local variant=$3 + local dockerfile=$4 + + IFS=',' read -r depthai_version depthai_sdk_version <<< "${versions[${robotics_vision_core}]}" + if [ -z "${depthai_version}" ]; then + echo "No version found for ${robotics_vision_core} in ${CONFIG_FILE}" + return fi - ROBOTHUB_VERSION="2.4.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" + local 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 "Building '${tag}'..." + echo "=> Depthai version: ${depthai_version}" + echo "=> Depthai SDK version: ${depthai_sdk_version}" echo "=> RobotHub version: ${ROBOTHUB_VERSION}" echo "================================" + LABELS=( + "--label" "org.opencontainers.image.source=https://github.com/luxonis/robothub-images" + "--label" "org.opencontainers.image.version=${tag}" + "--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.robothub.version=${ROBOTHUB_VERSION}" + ) + + BUILD_ARGS=( + "--build-arg" "BASE_IMAGE=${base_image}" + "--build-arg" "ROBOTICS_VISION_CORE=${robotics_vision_core}" + "--build-arg" "DEPTHAI_SDK_VERSION=${depthai_sdk_version}" + "--build-arg" "DEPTHAI_VERSION=${depthai_version}" + "--build-arg" "ROBOTHUB_VERSION=${ROBOTHUB_VERSION}" + "--build-arg" "VARIANT=${variant}" + ) + + # Check if the Robotics Vision Core version is not rvc2-depthaiV3 + if [[ "${robotics_vision_core}" != "rvc2-depthaiV3" ]]; then + LABELS+=("--label" "com.luxonis.rh.depthai-sdk.version=${depthai_sdk_version}") + fi + 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/ + "${BUILD_ARGS[@]}" \ + "${LABELS[@]}" \ + --tag "${tag}" \ + --push \ + --provenance=false \ + --file "dockerfiles/${dockerfile}" \ + context/ +} + +# Define base parameters +BASE_DOCKERFILE="base.Dockerfile" +DEPTHAI_V3_DOCKERFILE_CONTEXT="depthai-v3-git" + +declare -a elems=( + # RVC2 - DepthAI from registry: + "rvc2 ubuntu:22.04 minimal ${BASE_DOCKERFILE}" + "rvc2 ubuntu:22.04 regular ${BASE_DOCKERFILE}" + "rvc2 ros:humble-ros-core minimal ${BASE_DOCKERFILE}" + "rvc2 ros:humble-ros-base regular ${BASE_DOCKERFILE}" + + # RVC3 - DepthAI from registry: + "rvc3 ubuntu:22.04 minimal ${BASE_DOCKERFILE}" + "rvc3 ubuntu:22.04 regular ${BASE_DOCKERFILE}" + "rvc3 ros:humble-ros-core minimal ${BASE_DOCKERFILE}" + "rvc3 ros:humble-ros-base regular ${BASE_DOCKERFILE}" + + # RVC2 - DepthAI V3 - built from source: + "rvc2-depthaiV3 ubuntu:22.04 minimal ${DEPTHAI_V3_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" + "rvc2-depthaiV3 ubuntu:22.04 regular ${DEPTHAI_V3_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" + "rvc2-depthaiV3 ros:humble-ros-core minimal ${DEPTHAI_V3_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" + "rvc2-depthaiV3 ros:humble-ros-base regular ${DEPTHAI_V3_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" +) + +for elem in "${elems[@]}"; do + read -ra strarr <<<"$elem" + build_and_push_image "${strarr[0]}" "${strarr[1]}" "${strarr[2]}" "${strarr[3]}" done diff --git a/scripts/build-images-custom.sh b/scripts/build-images-custom.sh index fbc5853..3c14c25 100755 --- a/scripts/build-images-custom.sh +++ b/scripts/build-images-custom.sh @@ -1,74 +1,58 @@ #!/bin/bash set -Eeux -######## -# RVC2 # -######## +declare -A versions +CONFIG_FILE="scripts/versions.conf" +if [ ! -f "${CONFIG_FILE}" ]; then + echo "The file ${CONFIG_FILE} does not exist." + exit 1 +fi -DEPTHAI_VERSION="2.22.0.0.dev0+4f65e787340f0c83f8c03619d240bbb8af1260df" +echo "Reading versions from ${CONFIG_FILE}..." +while IFS='=' read -r key value; do + versions[$key]=$value +done < "${CONFIG_FILE}" -RVC2_BUILTIN_APP_TAG="${BASE_TAG}-rvc2-builtin-app" -echo "================================" -echo "Building '${RVC2_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 RVC2 builtin app image" \ - --label "org.opencontainers.image.description=DepthAI version: ${DEPTHAI_VERSION}" \ - --label "com.luxonis.rh.depthai.version=${DEPTHAI_VERSION}" \ - --tag "${RVC2_BUILTIN_APP_TAG}" \ - --push \ - --provenance=false \ - --file dockerfiles/custom/builtin-app.Dockerfile \ - context/ -######## -# RVC3 # -######## +build_and_push_image() { + local version_key=$1 + local tag_suffix=$2 + local dockerfile=$3 -DEPTHAI_VERSION="2.22.0.0.dev0+8b9eceb316ce60d57d9157ecec48534b548e8904" + IFS=',' read -r depthai_version _ <<< "${versions[${version_key}]}" -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/builtin-app.Dockerfile \ - context/ + if [ -z "${depthai_version}" ]; then + echo "No version found for ${version_key} in ${CONFIG_FILE}" + return + fi -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/ + local tag="${BASE_TAG}-${tag_suffix}" + echo "================================" + echo "Building '${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 ${tag_suffix} image" \ + --label "org.opencontainers.image.description=DepthAI version: ${depthai_version}" \ + --label "com.luxonis.rh.depthai.version=${depthai_version}" \ + --tag "${tag}" \ + --push \ + --provenance=false \ + --file "dockerfiles/${dockerfile}" \ + context/ +} + +BASE_DOCKERFILE="builtin-app.Dockerfile" +CUSTOM_DOCKERFILE_CONTEXT="custom" +build_and_push_image "rvc2" "rvc2-builtin-app" "${CUSTOM_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" +build_and_push_image "rvc3" "rvc3-builtin-app" "${CUSTOM_DOCKERFILE_CONTEXT}/${BASE_DOCKERFILE}" +build_and_push_image "rvc3" "rae-provisioning-app" "${CUSTOM_DOCKERFILE_CONTEXT}/rae-provisioning-app.Dockerfile" + +# Build images for RVC2 DepthAI V3: +build_and_push_image "rvc2-depthaiV3" "rvc2-depthaiV3-builtin-app" "depthai-v3-git/${BASE_DOCKERFILE}" diff --git a/scripts/make-manifests.sh b/scripts/make-manifests.sh index ebe4f2e..787b191 100755 --- a/scripts/make-manifests.sh +++ b/scripts/make-manifests.sh @@ -12,11 +12,16 @@ declare -a suffixes=( "rvc2-regular" "rvc2-minimal-ros2humble" "rvc2-regular-ros2humble" + "rvc2-depthaiV3-minimal" + "rvc2-depthaiV3-regular" + "rvc2-depthaiV3-minimal-ros2humble" + "rvc2-depthaiV3-regular-ros2humble" "rvc3-minimal" "rvc3-regular" "rvc3-minimal-ros2humble" "rvc3-regular-ros2humble" "rvc2-builtin-app" + "rvc2-depthaiV3-builtin-app" "rvc3-builtin-app" "rae-provisioning-app" ) diff --git a/scripts/versions.conf b/scripts/versions.conf new file mode 100644 index 0000000..f8f9dbf --- /dev/null +++ b/scripts/versions.conf @@ -0,0 +1,3 @@ +rvc2=2.22.0.0.dev0+4f65e787340f0c83f8c03619d240bbb8af1260df,1.12.1 +rvc2-depthaiV3=git+https://github.com/luxonis/depthai-python.git@preV3,1.12.1 +rvc3=2.22.0.0.dev0+8b9eceb316ce60d57d9157ecec48534b548e8904,d188eec84fded7ea10a3dc124db7da433a2a3578