Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM ubuntu:22.04
  2. ARG HTTP_PROXY
  3. ARG HTTPS_PROXY
  4. ENV http_proxy=${HTTP_PROXY}
  5. ENV https_proxy=${HTTPS_PROXY}
  6. # 1. Basic options(with root)
  7. RUN apt update && \
  8. apt install -y software-properties-common && \
  9. add-apt-repository universe && \
  10. apt update && \
  11. apt install -y --no-install-recommends \
  12. sudo git wget python3 python3-pip scons vim xz-utils minicom && \
  13. pip3 install esptool && \
  14. useradd -m dev && \
  15. echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  16. # 2. Switch to dev user
  17. USER dev
  18. WORKDIR /home/dev
  19. # 3. Install esp-idf toolchains
  20. RUN wget -q https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz && \
  21. sudo tar -xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz -C /opt
  22. # 4. Clone RT-Thread and switch master
  23. RUN git clone https://github.com/RT-Thread/rt-thread.git && \
  24. cd rt-thread && \
  25. git switch master
  26. # 5. Install env tools
  27. WORKDIR /home/dev/rt-thread
  28. RUN wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh && \
  29. chmod +x install_ubuntu.sh && \
  30. ./install_ubuntu.sh
  31. # 6. Modify toolchains path
  32. RUN sed -i "s|^.*EXEC_PATH.*| EXEC_PATH = r'/opt/riscv32-esp-elf/bin'|" bsp/ESP32_C3/rtconfig.py
  33. # 7. Set enviroment variables
  34. ENV PATH="/opt/riscv32-esp-elf/bin:/home/dev/.env/tools/scripts:$PATH"
  35. # 8. Update rtthread packages
  36. WORKDIR /home/dev/rt-thread/bsp/ESP32_C3
  37. RUN pkgs --update