Dockerfile 2.6 KB

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