# Reproducible build environment for dora-zed. # # Compiles only — no camera is needed. Requires an NVIDIA driver and the NVIDIA # Container Toolkit on the host, as the ZED SDK does anyway. # # NVIDIA_DRIVER_CAPABILITIES below includes `video` because libsl_zed.so links # against NVDEC (libnvcuvid) and NVENC (libnvidia-encode); the container runtime # mounts those from the host only when `video` is in the list. # # Ubuntu 24.04 is the newest release Stereolabs ships a ZED SDK for. # # docker build -t dora-zed-build . # docker run --rm --gpus all --user "$(id -u):$(id -g)" \ # -v "$PWD:/src" -v dora-zed-cargo:/usr/local/cargo/registry dora-zed-build # # --user keeps build/ and bin/ owned by you instead of root. # # The first run clones dora-rs and compiles it with Cargo, which takes a while; # the named volume keeps the registry cache across runs. FROM nvidia/cuda:12.8.1-devel-ubuntu24.04 ARG ZED_VERSION=5.2 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential cmake git curl ca-certificates pkg-config \ libopencv-dev zstd udev sudo \ && rm -rf /var/lib/apt/lists/* # The toolchain lives outside /root so the container can run as the invoking # user (--user) and still write the cargo caches. registry/ is created here so # that a named volume mounted over it inherits these permissions rather than # being created root-owned. ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:${PATH} RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | sh -s -- -y --profile minimal --default-toolchain stable \ && mkdir -p ${CARGO_HOME}/registry \ && chmod -R a+w ${RUSTUP_HOME} ${CARGO_HOME} # The installer leaves /usr/local/zed as drwxrwx--- root:zed, which an arbitrary # --user uid cannot read, so relax it to make find_package(zed) work for one. RUN curl -fSL -o /tmp/ZED_SDK.run \ "https://download.stereolabs.com/zedsdk/${ZED_VERSION}/cu12/ubuntu24" \ && chmod +x /tmp/ZED_SDK.run \ && /tmp/ZED_SDK.run -- silent skip_python skip_tools skip_drivers skip_cuda \ && chmod -R a+rX /usr/local/zed \ && rm -f /tmp/ZED_SDK.run ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video WORKDIR /src CMD ["scripts/build.sh"]