# Dockerfile for OpenWrt-Yocto Build Environment # # Yocto Project does NOT natively support macOS. # This Dockerfile provides an Ubuntu-based container with all # required build dependencies for Yocto/OpenEmbedded builds. # # Based on Yocto Project Scarthgap (5.0) system requirements: # https://docs.yoctoproject.org/ref-manual/system-requirements.html FROM ubuntu:24.04 # Prevent interactive prompts during package installation ENV DEBIAN_FRONTEND=noninteractive # Install all required Yocto build host packages (from poky/documentation/poky.yaml.in) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ chrpath \ cpio \ debianutils \ diffstat \ file \ gawk \ gcc \ git \ iputils-ping \ libacl1 \ liblz4-tool \ locales \ python3 \ python3-git \ python3-jinja2 \ python3-pexpect \ python3-pip \ python3-subunit \ socat \ texinfo \ unzip \ wget \ xz-utils \ zstd \ # Additional useful tools sudo \ vim \ nano \ less \ bash-completion \ && rm -rf /var/lib/apt/lists/* # Set up locale (required by Yocto) RUN locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8 ENV LANG=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 # Create a non-root user to match macOS host user (builds should not run as root) ARG USER_UID=1000 ARG USER_GID=1000 RUN groupadd -g ${USER_GID} builduser && \ useradd -m -u ${USER_UID} -g builduser -s /bin/bash builduser && \ echo "builduser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers # Create working directory RUN mkdir -p /workspace && chown builduser:builduser /workspace # Switch to non-root user USER builduser WORKDIR /workspace # Set Git safe directory (since the mounted volume may have different ownership) RUN git config --global --add safe.directory /workspace ENTRYPOINT ["/bin/bash"]