Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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-venv \
  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. && :
  33. # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
  34. # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
  35. # It is possibe to combine both, e.g.:
  36. # IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
  37. # IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
  38. # Use IDF_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules)
  39. # Use IDF_INSTALL_TARGETS to install tools only for selected chip targets (CSV)
  40. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  41. ARG IDF_CLONE_BRANCH_OR_TAG=master
  42. ARG IDF_CHECKOUT_REF=
  43. ARG IDF_CLONE_SHALLOW=
  44. ARG IDF_INSTALL_TARGETS=all
  45. ENV IDF_PATH=/opt/esp/idf
  46. ENV IDF_TOOLS_PATH=/opt/esp
  47. RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
  48. git clone --recursive \
  49. ${IDF_CLONE_SHALLOW:+--depth=1 --shallow-submodules} \
  50. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  51. $IDF_CLONE_URL $IDF_PATH && \
  52. if [ -n "$IDF_CHECKOUT_REF" ]; then \
  53. cd $IDF_PATH && \
  54. if [ -n "$IDF_CLONE_SHALLOW" ]; then \
  55. git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF}; \
  56. fi && \
  57. git checkout $IDF_CHECKOUT_REF && \
  58. git submodule update --init --recursive; \
  59. fi
  60. # Install all the required tools
  61. RUN : \
  62. && update-ca-certificates --fresh \
  63. && $IDF_PATH/tools/idf_tools.py --non-interactive install required --targets=${IDF_INSTALL_TARGETS} \
  64. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  65. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  66. && rm -rf $IDF_TOOLS_PATH/dist \
  67. && :
  68. # Ccache is installed, enable it by default
  69. ENV IDF_CCACHE_ENABLE=1
  70. COPY entrypoint.sh /opt/esp/entrypoint.sh
  71. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  72. CMD [ "/bin/bash" ]