Dockerfile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. FROM ubuntu:20.04
  2. ARG DEBIAN_FRONTEND=noninteractive
  3. ENV GCC_TOOLS_BASE=/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-
  4. # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
  5. # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
  6. # It is possibe to combine both, e.g.:
  7. # IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
  8. # IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
  9. # The following commit contains the ldgen fix: eab738c79e063b3d6f4c345ea5e1d4f8caef725b
  10. # to build an image using that commit: docker build . --build-arg IDF_CHECKOUT_REF=eab738c79e063b3d6f4c345ea5e1d4f8caef725b -t sle118/squeezelite-esp32-idfv43
  11. # Docker build for release 4.3.2 as of 2022/02/28
  12. # docker build . --build-arg IDF_CHECKOUT_REF=8bf14a9238329954c7c5062eeeda569529aedf75 -t sle118/squeezelite-esp32-idfv43
  13. # To run the image interactive (windows):
  14. # docker run --rm -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv43
  15. # To run the image interactive (linux):
  16. # docker run --rm -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv43
  17. # to build the web app inside of the interactive session
  18. # pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd
  19. #
  20. # to run the docker with netwotrk port published on the host:
  21. # docker run --rm -p 5000:5000/tcp -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv43
  22. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  23. ARG IDF_CLONE_BRANCH_OR_TAG=master
  24. ARG IDF_CHECKOUT_REF=8bf14a9238329954c7c5062eeeda569529aedf75
  25. ENV IDF_PATH=/opt/esp/idf
  26. ENV IDF_TOOLS_PATH=/opt/esp
  27. # We need libpython2.7 due to GDB tools
  28. # we also need npm 8 for the webapp to work
  29. RUN : \
  30. && apt-get update \
  31. && apt-get install -y \
  32. apt-utils \
  33. bison \
  34. ca-certificates \
  35. ccache \
  36. check \
  37. curl \
  38. flex \
  39. git \
  40. gperf \
  41. lcov \
  42. libffi-dev \
  43. libncurses-dev \
  44. libpython2.7 \
  45. libusb-1.0-0-dev \
  46. make \
  47. ninja-build \
  48. python3 \
  49. python3-pip \
  50. unzip \
  51. wget \
  52. xz-utils \
  53. zip \
  54. npm \
  55. nodejs \
  56. && apt-get autoremove -y \
  57. && rm -rf /var/lib/apt/lists/* \
  58. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  59. && python -m pip install --upgrade \
  60. pip \
  61. virtualenv \
  62. && cd /opt \
  63. && git clone https://github.com/HBehrens/puncover.git \
  64. && cd puncover \
  65. && python setup.py -q install \
  66. && echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG \
  67. && git clone --recursive \
  68. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  69. $IDF_CLONE_URL $IDF_PATH \
  70. && if [ -n "$IDF_CHECKOUT_REF" ]; then \
  71. cd $IDF_PATH \
  72. && git checkout $IDF_CHECKOUT_REF \
  73. && git submodule update --init --recursive; \
  74. fi \
  75. && update-ca-certificates --fresh \
  76. && $IDF_PATH/tools/idf_tools.py --non-interactive install required \
  77. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  78. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  79. && :
  80. RUN : \
  81. echo Installing pygit2 ******************************************************** \
  82. && . /opt/esp/python_env/idf4.3_py3.8_env/bin/activate \
  83. && ln -sf /opt/esp/python_env/idf4.3_py3.8_env/bin/python /usr/local/bin/python \
  84. && pip install pygit2 requests \
  85. && pip show pygit2 \
  86. && python --version \
  87. && pip --version \
  88. && pip install protobuf grpcio-tools \
  89. && rm -rf $IDF_TOOLS_PATH/dist \
  90. && :
  91. COPY docker/patches $IDF_PATH
  92. #set idf environment variabies
  93. ENV PATH /opt/esp/idf/components/esptool_py/esptool:/opt/esp/idf/components/espcoredump:/opt/esp/idf/components/partition_table:/opt/esp/idf/components/app_update:/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin:/opt/esp/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin:/opt/esp/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-2021r2-8.4.0/riscv32-esp-elf/bin:/opt/esp/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/opt/esp/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/opt/esp/tools/cmake/3.16.4/bin:/opt/esp/tools/openocd-esp32/v0.10.0-esp32-20211111/openocd-esp32/bin:/opt/esp/python_env/idf4.3_py3.8_env/bin:/opt/esp/idf/tools:$PATH
  94. ENV GCC_TOOLS_BASE="/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-"
  95. ENV IDF_PATH="/opt/esp/idf"
  96. ENV IDF_PYTHON_ENV_PATH="/opt/esp/python_env/idf4.3_py3.8_env"
  97. ENV IDF_TOOLS_EXPORT_CMD="/opt/esp/idf/export.sh"
  98. ENV IDF_TOOLS_INSTALL_CMD="/opt/esp/idf/install.sh"
  99. ENV IDF_TOOLS_PATH="/opt/esp"
  100. ENV NODE_PATH="/v8/lib/node_modules"
  101. ENV NODE_VERSION="8"
  102. ENV OPENOCD_SCRIPTS="/opt/esp/tools/openocd-esp32/v0.10.0-esp32-20211111/openocd-esp32/share/openocd/scripts"
  103. # Ccache is installed, enable it by default
  104. ENV IDF_CCACHE_ENABLE=1
  105. COPY docker/entrypoint.sh /opt/esp/entrypoint.sh
  106. COPY components/wifi-manager/webapp/package.json /opt
  107. ENV NODE_VERSION 8
  108. SHELL ["/bin/bash", "--login", "-c"]
  109. # Install nvm with node and npm
  110. # RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
  111. # && export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" \
  112. # && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
  113. # && nvm install $NODE_VERSION \
  114. # && nvm alias default $NODE_VERSION \
  115. # && nvm use default \
  116. # && echo installing nodejs version 16 \
  117. # && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
  118. # && echo installing node modules \
  119. # && cd /opt \
  120. # && nvm use default \
  121. # && npm install -g \
  122. # && :
  123. RUN : \
  124. && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
  125. && apt-get install -y nodejs jq \
  126. && echo installing dev node modules globally \
  127. && cd /opt \
  128. && cat ./package.json | jq '.devDependencies | keys[] as $k | "\($k)@\(.[$k])"' | xargs -t npm install --global \
  129. && echo installing npm global packages \
  130. && npm i -g npm \
  131. && node --version \
  132. && npm install -g \
  133. && :
  134. ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
  135. ENV PATH $IDF_PYTHON_ENV_PATH:$NVM_DIR/v$NODE_VERSION/bin:$PATH
  136. COPY ./docker/build_tools.py /usr/sbin/build_tools.py
  137. RUN : \
  138. && echo Changing permissions ******************************************************** \
  139. && chmod +x /opt/esp/entrypoint.sh \
  140. && chmod +x /usr/sbin/build_tools.py \
  141. && :
  142. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  143. CMD [ "/bin/bash" ]