From 92b9df09abccd39085f9c22c5bab86ad05ff3a0e Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 18 Jun 2024 09:55:38 -0700 Subject: [PATCH 1/5] add docker-build --- tools/docker-build/Dockerfile | 56 +++++++++++++++++++++++++++++++++++ tools/docker-build/README.md | 25 ++++++++++++++++ tools/docker-build/build | 9 ++++++ tools/docker-build/build.sh | 18 +++++++++++ 4 files changed, 108 insertions(+) create mode 100644 tools/docker-build/Dockerfile create mode 100644 tools/docker-build/README.md create mode 100755 tools/docker-build/build create mode 100644 tools/docker-build/build.sh diff --git a/tools/docker-build/Dockerfile b/tools/docker-build/Dockerfile new file mode 100644 index 000000000000..466a35972b71 --- /dev/null +++ b/tools/docker-build/Dockerfile @@ -0,0 +1,56 @@ +# Use a base image with the necessary tools +FROM ubuntu:24.04 as build + +RUN apt-get update && apt-get install -y build-essential software-properties-common git git-lfs gettext cmake mtools wget curl which + +ARG ARM_TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/ +ARG ARM_TOOLCHAIN_FILE=arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.gz +ARG DOWNLOAD_DIR=/root/bin + +RUN mkdir ${DOWNLOAD_DIR} && cd ${DOWNLOAD_DIR} && curl -LO ${ARM_TOOLCHAIN_URL}/${ARM_TOOLCHAIN_FILE} + +RUN cd ${DOWNLOAD_DIR} && pwd && tar -xf ${ARM_TOOLCHAIN_FILE} + +ARG ARM_TOOLCHAIN_DIR=arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi + +ENV PATH="${PATH}:${DOWNLOAD_DIR}/${ARM_TOOLCHAIN_DIR}/bin" + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -y | sh + +RUN apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build + +RUN apt-get install -y ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 python-is-python3 + +# RUN mkdir -p /root/adafruit && cd /root/adafruit && git clone https://github.com/adafruit/circuitpython.git + +ENV IDF_TOOLS_PATH=/root/.espressif +ENV IDF_PATH=/root/esp/esp-idf + +RUN mkdir -p /root/esp && cd /root/esp && git clone -b v5.2.2 --recursive https://github.com/espressif/esp-idf.git && ls + +RUN cd /root/esp/esp-idf && ./install.sh all + +RUN curl -LO https://raw.githubusercontent.com/adafruit/circuitpython/main/requirements-dev.txt + +RUN curl -LO https://raw.githubusercontent.com/adafruit/circuitpython/main/requirements-doc.txt + +RUN . /root/esp/esp-idf/export.sh && pip3 install --upgrade -r requirements-dev.txt && \ + pip3 install --upgrade -r requirements-doc.txt + +# RUN . /root/esp/esp-idf/export.sh && pip3 install --upgrade -r /root/adafruit/circuitpython/requirements-dev.txt && \ +# pip3 install --upgrade -r /root/adafruit/circuitpython/requirements-doc.txt + +# RUN cd /root/adafruit/circuitpython && make fetch-all-submodules + +# RUN cd /root/adafruit/circuitpython/ports/espressif && . /root/esp/esp-idf/export.sh && make BOARD=espressif_esp32s3_devkitc_1_n8 + +# RUN rm -rf /root/adafruit + +COPY build.sh /root + +RUN chmod +x /root/build.sh + +ENTRYPOINT ["/bin/bash"] + +# sudo chown -R "${USER:-$(id -un)}" . + diff --git a/tools/docker-build/README.md b/tools/docker-build/README.md new file mode 100644 index 000000000000..f31c61cdd1f3 --- /dev/null +++ b/tools/docker-build/README.md @@ -0,0 +1,25 @@ +# Building CircuitPython with Docker + +On a Linux machine with `docker` installed, an executable for any supported CircuitPython board can be built without setup by invoking the command `tools/docker-build/build