# syntax=docker/dockerfile:1 #-- Build configuration --# # ARCH_CFLAGS is supplied as a compile option ARG ARCH_CFLAGS="-O2 -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fomit-frame-pointer" # AXIS_ARCH is the AXIS platform descriptor ARG AXIS_ARCH=armv7hf # BUILD_ROOT defines where in the build containers the building takes place ARG BUILD_ROOT=/build-root # DOCKERHUB_ARCH is the DockerHub platform descriptor ARG DOCKERHUB_ARCH=arm32v7 # OPENCV_MODULES defines what OpenCV modules to build ARG OPENCV_MODULES=core,imgproc,imgcodecs,videoio,objdetect,python3,video # SDK_ROOT_DIR defines the root directory of the final SDK images ARG SDK_ROOT_DIR=/axis/ # UBUNTU_ARCH is the Ubuntu platform descriptor ARG UBUNTU_ARCH=armhf # TARGET_TOOLCHAIN is the name of the compilation toolchain for the target platform ARG TARGET_TOOLCHAIN=arm-linux-gnueabihf #CMAKE_TOOLCHAIN_FOLDER is the name of the CMAKE toolchain folder ARG CMAKE_TOOLCHAIN_FOLDER=arm-gnueabi # TARGET_ROOT defines where in the build containers the resulting application is put ARG TARGET_ROOT=/target-root # UBUNTU_VERSION defines the ubuntu version of the build and SDK containers ARG UBUNTU_VERSION=22.04 # UBUNTU_CODENAME should be the ubuntu codename of the UBUNTU_VERSION used, e.g., focal, hirsute, .. ARG UBUNTU_CODENAME=jammy #-- Versions of installed packages defined as repository tags --# ARG NUMPY_VERSION=v1.17.3 ARG OPENBLAS_VERSION=v0.3.14 ARG OPENCV_VERSION=4.5.1 ARG PYTHON_VERSION=3.8.8 ARG PYTESSERACT_VERSION=0.3.7 ARG SCIPY_VERSION=v1.7.1 ARG TESSERACT_VERSION=4.1.1 ARG TFSERVING_VERSION=2.9.0 #-- Build parallelization --# ARG OPENBLAS_BUILD_CORES=16 ARG OPENCV_BUILD_CORES=16 ARG PYTHON_BUILD_CORES=16 ARG NUMPY_BUILD_CORES=16 ARG SCIPY_BUILD_CORES=16 ARG TESSERACT_BUILD_CORES=16 ARG TENSORFLOW_BUILD_CORES=16 #-- ACAP SDK configuration --# ARG REPO=axisecp ARG ACAP_SDK_IMAGE=acap-native-sdk ARG ACAP_SDK_UBUNTU_VERSION=22.04 ARG ACAP_SDK_VERSION=1.6_rc1 ARG ACAP_SDK_TAG=${ACAP_SDK_VERSION}-${AXIS_ARCH}-ubuntu${ACAP_SDK_UBUNTU_VERSION} # The ACAP Native SDK is used to get certain libs and headers FROM ${REPO}/${ACAP_SDK_IMAGE}:${ACAP_SDK_TAG} AS acap-native-sdk # libs: /opt/axis/acapsdk/sysroots/$AXIS_ARCH/usr/lib/ # headers: /opt/axis/acapsdk/sysroots/$AXIS_ARCH/usr/include/ # Create a emulated base image with build tools, env vars, etc., FROM $DOCKERHUB_ARCH/ubuntu:${UBUNTU_VERSION} as build-base-arm ARG BUILD_ROOT ENV DEBIAN_FRONTEND=noninteractive ARG PYTHON_VERSION ARG TARGET_TOOLCHAIN ARG TARGET_ROOT ARG UBUNTU_ARCH ARG http_proxy ARG https_proxy # To support DOCKER_BUILDKIT=0, base ARGs are converted to ENVs to allow propagation ENV BUILD_ROOT=$BUILD_ROOT ENV TARGET_TOOLCHAIN=$TARGET_TOOLCHAIN ENV TARGET_ROOT=$TARGET_ROOT ENV UBUNTU_ARCH=$UBUNTU_ARCH ENV http_proxy=$http_proxy ENV https_proxy=$https_proxy # qemu is used to emulate arm COPY --from=multiarch/qemu-user-static:x86_64-arm-6.1.0-8 /usr/bin/qemu-arm-static /usr/bin/ RUN <