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