Dockerfile 2.7 KB

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