Dockerfile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. FROM ubuntu:22.04
  2. ARG DEBIAN_FRONTEND=noninteractive
  3. RUN : \
  4. && apt-get update \
  5. && apt-get install -y \
  6. apt-utils \
  7. bison \
  8. ca-certificates \
  9. ccache \
  10. check \
  11. curl \
  12. flex \
  13. git \
  14. git-lfs \
  15. gperf \
  16. lcov \
  17. libbsd-dev \
  18. libffi-dev \
  19. libncurses-dev \
  20. libusb-1.0-0-dev \
  21. make \
  22. ninja-build \
  23. python3 \
  24. python3-venv \
  25. ruby \
  26. unzip \
  27. wget \
  28. xz-utils \
  29. zip \
  30. && apt-get autoremove -y \
  31. && rm -rf /var/lib/apt/lists/* \
  32. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  33. && :
  34. # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
  35. # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
  36. # It is possibe to combine both, e.g.:
  37. # IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
  38. # IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
  39. # Use IDF_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules)
  40. # Use IDF_INSTALL_TARGETS to install tools only for selected chip targets (CSV)
  41. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  42. ARG IDF_CLONE_BRANCH_OR_TAG=master
  43. ARG IDF_CHECKOUT_REF=
  44. ARG IDF_CLONE_SHALLOW=
  45. ARG IDF_INSTALL_TARGETS=all
  46. ENV IDF_PATH=/opt/esp/idf
  47. ENV IDF_TOOLS_PATH=/opt/esp
  48. # install build essential needed for linux target apps, which is a preview target so it is installed with "all" only
  49. RUN if [ "$IDF_INSTALL_TARGETS" = "all" ]; then \
  50. apt-get update \
  51. && apt-get install -y build-essential \
  52. && apt-get autoremove -y \
  53. && rm -rf /var/lib/apt/lists/* ; \
  54. fi
  55. RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
  56. git clone --recursive \
  57. ${IDF_CLONE_SHALLOW:+--depth=1 --shallow-submodules} \
  58. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  59. $IDF_CLONE_URL $IDF_PATH && \
  60. if [ -n "$IDF_CHECKOUT_REF" ]; then \
  61. cd $IDF_PATH && \
  62. if [ -n "$IDF_CLONE_SHALLOW" ]; then \
  63. git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF}; \
  64. fi && \
  65. git checkout $IDF_CHECKOUT_REF && \
  66. git submodule update --init --recursive; \
  67. fi
  68. # Install all the required tools
  69. RUN : \
  70. && update-ca-certificates --fresh \
  71. && $IDF_PATH/tools/idf_tools.py --non-interactive install required --targets=${IDF_INSTALL_TARGETS} \
  72. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  73. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  74. && rm -rf $IDF_TOOLS_PATH/dist \
  75. && :
  76. # The constraint file has been downloaded and the right Python package versions installed. No need to check and
  77. # download this at every invocation of the container.
  78. ENV IDF_PYTHON_CHECK_CONSTRAINTS=no
  79. # Ccache is installed, enable it by default
  80. ENV IDF_CCACHE_ENABLE=1
  81. # Install QEMU runtime dependencies
  82. RUN : \
  83. && apt-get update && apt-get install -y -q \
  84. bzip2 \
  85. libglib2.0-0 \
  86. libpixman-1-0 \
  87. libslirp0 \
  88. && rm -rf /var/lib/apt/lists/* \
  89. && :
  90. # Install QEMU
  91. ARG QEMU_VER=develop_8.0.0_20230522
  92. ARG QEMU_RISCV32_DIST=esp-qemu-riscv32-softmmu-${QEMU_VER}-x86_64-linux-gnu.tar.bz2
  93. ARG QEMU_RISCV32_SHA256=bc7607720ff3d7e3d39f3e1810b8795f376f4b9cf3783c8f2ed3f7f14ba74717
  94. ARG QEMU_XTENSA_DIST=esp-qemu-xtensa-softmmu-${QEMU_VER}-x86_64-linux-gnu.tar.bz2
  95. ARG QEMU_XTENSA_SHA256=a7e5e779fd593cb15f6d197034dc2fb427ed9165a4743e2febc6f6a47dfcc618
  96. RUN bash -c ': \
  97. && wget --no-verbose https://github.com/espressif/qemu/releases/download/esp-${QEMU_VER//_/-}/${QEMU_RISCV32_DIST} \
  98. && echo "${QEMU_RISCV32_SHA256} *${QEMU_RISCV32_DIST}" | sha256sum --check --strict - \
  99. && tar -xf ${QEMU_RISCV32_DIST} -C /opt \
  100. && rm ${QEMU_RISCV32_DIST} \
  101. && wget --no-verbose https://github.com/espressif/qemu/releases/download/esp-${QEMU_VER//_/-}/${QEMU_XTENSA_DIST} \
  102. && echo "${QEMU_XTENSA_SHA256} *${QEMU_XTENSA_DIST}" | sha256sum --check --strict - \
  103. && tar -xf ${QEMU_XTENSA_DIST} -C /opt \
  104. && rm ${QEMU_XTENSA_DIST} \
  105. '
  106. ENV PATH=/opt/qemu/bin:${PATH}
  107. COPY entrypoint.sh /opt/esp/entrypoint.sh
  108. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  109. CMD [ "/bin/bash" ]