Dockerfile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. libffi-dev \
  18. libncurses-dev \
  19. libpython2.7 \
  20. libusb-1.0-0-dev \
  21. make \
  22. ninja-build \
  23. python3 \
  24. python3-pip \
  25. unzip \
  26. wget \
  27. xz-utils \
  28. zip \
  29. && apt-get autoremove -y \
  30. && rm -rf /var/lib/apt/lists/* \
  31. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  32. && python -m pip install --upgrade \
  33. pip \
  34. virtualenv \
  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. # Ccache is installed, enable it by default
  72. ENV IDF_CCACHE_ENABLE=1
  73. COPY entrypoint.sh /opt/esp/entrypoint.sh
  74. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  75. CMD [ "/bin/bash" ]