Dockerfile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. bzip2 \
  9. ca-certificates \
  10. ccache \
  11. check \
  12. curl \
  13. flex \
  14. git \
  15. git-lfs \
  16. gperf \
  17. lcov \
  18. libbsd-dev \
  19. libffi-dev \
  20. libglib2.0-0 \
  21. libncurses-dev \
  22. libpixman-1-0 \
  23. libslirp0 \
  24. libusb-1.0-0-dev \
  25. make \
  26. ninja-build \
  27. python3 \
  28. python3-venv \
  29. ruby \
  30. unzip \
  31. wget \
  32. xz-utils \
  33. zip \
  34. && apt-get autoremove -y \
  35. && rm -rf /var/lib/apt/lists/* \
  36. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  37. && :
  38. # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
  39. # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
  40. # It is possibe to combine both, e.g.:
  41. # IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
  42. # IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
  43. # Use IDF_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules)
  44. # Use IDF_INSTALL_TARGETS to install tools only for selected chip targets (CSV)
  45. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  46. ARG IDF_CLONE_BRANCH_OR_TAG=master
  47. ARG IDF_CHECKOUT_REF=
  48. ARG IDF_CLONE_SHALLOW=
  49. ARG IDF_INSTALL_TARGETS=all
  50. ENV IDF_PATH=/opt/esp/idf
  51. ENV IDF_TOOLS_PATH=/opt/esp
  52. # install build essential needed for linux target apps, which is a preview target so it is installed with "all" only
  53. RUN if [ "$IDF_INSTALL_TARGETS" = "all" ]; then \
  54. apt-get update \
  55. && apt-get install -y build-essential \
  56. && apt-get autoremove -y \
  57. && rm -rf /var/lib/apt/lists/* ; \
  58. fi
  59. RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
  60. git clone --recursive \
  61. ${IDF_CLONE_SHALLOW:+--depth=1 --shallow-submodules} \
  62. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  63. $IDF_CLONE_URL $IDF_PATH && \
  64. git config --system --add safe.directory $IDF_PATH && \
  65. if [ -n "$IDF_CHECKOUT_REF" ]; then \
  66. cd $IDF_PATH && \
  67. if [ -n "$IDF_CLONE_SHALLOW" ]; then \
  68. git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF}; \
  69. fi && \
  70. git checkout $IDF_CHECKOUT_REF && \
  71. git submodule update --init --recursive; \
  72. fi
  73. # Install all the required tools
  74. RUN : \
  75. && update-ca-certificates --fresh \
  76. && $IDF_PATH/tools/idf_tools.py --non-interactive install required --targets=${IDF_INSTALL_TARGETS} \
  77. && $IDF_PATH/tools/idf_tools.py --non-interactive install qemu* --targets=${IDF_INSTALL_TARGETS} \
  78. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  79. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  80. && rm -rf $IDF_TOOLS_PATH/dist \
  81. && :
  82. # The constraint file has been downloaded and the right Python package versions installed. No need to check and
  83. # download this at every invocation of the container.
  84. ENV IDF_PYTHON_CHECK_CONSTRAINTS=no
  85. # Ccache is installed, enable it by default
  86. ENV IDF_CCACHE_ENABLE=1
  87. COPY entrypoint.sh /opt/esp/entrypoint.sh
  88. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  89. CMD [ "/bin/bash" ]