Dockerfile 2.6 KB

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