Dockerfile 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. FROM ubuntu:20.04
  2. ARG DEBIAN_FRONTEND=noninteractive
  3. ENV GCC_TOOLS_BASE=/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-patch3-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. # Docker build for release 4.3.5 as of 2023/05/18
  10. # docker build . --build-arg IDF_CHECKOUT_REF=6d04316cbe4dc35ea7e4885e9821bd9958ac996d -t sle118/squeezelite-esp32-idfv435
  11. # Updating the docker image in the repository
  12. # docker push sle118/squeezelite-esp32-idfv435
  13. # or to do both:
  14. # docker build . --build-arg IDF_CHECKOUT_REF=6d04316cbe4dc35ea7e4885e9821bd9958ac996d -t sle118/squeezelite-esp32-idfv435 && docker push sle118/squeezelite-esp32-idfv435
  15. #
  16. # (windows) To run the image interactive :
  17. # docker run --rm -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv435
  18. # (windows powershell)
  19. # docker run --rm -v ${PWD}:/project -w /project -it sle118/squeezelite-esp32-idfv435
  20. # (linux) To run the image interactive :
  21. # docker run --rm -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv435
  22. # to build the web app inside of the interactive session
  23. # pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd
  24. #
  25. # to run the docker with netwotrk port published on the host:
  26. # (windows)
  27. # docker run --rm -p 5000:5000/tcp -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv435
  28. # (linux)
  29. # docker run --rm -p 5000:5000/tcp -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv435
  30. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  31. ARG IDF_CLONE_BRANCH_OR_TAG=master
  32. ARG IDF_CHECKOUT_REF=6d04316cbe4dc35ea7e4885e9821bd9958ac996d
  33. ENV IDF_PATH=/opt/esp/idf
  34. ENV IDF_TOOLS_PATH=/opt/esp
  35. # We need libpython2.7 due to GDB tools
  36. # we also need npm 8 for the webapp to work
  37. RUN : \
  38. && apt-get update \
  39. && apt-get install -y \
  40. apt-utils \
  41. build-essential \
  42. bison \
  43. ca-certificates \
  44. ccache \
  45. check \
  46. curl \
  47. flex \
  48. git \
  49. git-lfs \
  50. gperf \
  51. lcov \
  52. libbsd-dev \
  53. libpython3.8 \
  54. libffi-dev \
  55. libncurses-dev \
  56. libusb-1.0-0-dev \
  57. make \
  58. ninja-build \
  59. python3.8 \
  60. python3-pip \
  61. python3-venv \
  62. ruby \
  63. unzip \
  64. wget \
  65. xz-utils \
  66. zip \
  67. npm \
  68. nodejs \
  69. && apt-get autoremove -y \
  70. && rm -rf /var/lib/apt/lists/* \
  71. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  72. && python -m pip install --upgrade \
  73. pip \
  74. virtualenv \
  75. && cd /opt \
  76. && git clone https://github.com/HBehrens/puncover.git \
  77. && cd puncover \
  78. && python setup.py -q install \
  79. && echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG \
  80. && git clone --recursive \
  81. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  82. $IDF_CLONE_URL $IDF_PATH \
  83. && if [ -n "$IDF_CHECKOUT_REF" ]; then \
  84. cd $IDF_PATH \
  85. && git checkout $IDF_CHECKOUT_REF \
  86. && git submodule update --init --recursive; \
  87. fi \
  88. && update-ca-certificates --fresh \
  89. && $IDF_PATH/tools/idf_tools.py --non-interactive install required \
  90. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  91. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  92. && :
  93. RUN : \
  94. echo Installing pygit2 ******************************************************** \
  95. && . /opt/esp/python_env/idf4.3_py3.8_env/bin/activate \
  96. && ln -sf /opt/esp/python_env/idf4.3_py3.8_env/bin/python /usr/local/bin/python \
  97. && pip install pygit2 requests \
  98. && pip show pygit2 \
  99. && python --version \
  100. && pip --version \
  101. && pip install protobuf grpcio-tools \
  102. && rm -rf $IDF_TOOLS_PATH/dist \
  103. && :
  104. COPY docker/patches $IDF_PATH
  105. #set idf environment variabies
  106. 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-patch3-8.4.0/xtensa-esp32-elf/bin:/opt/esp/tools/xtensa-esp32s2-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s2-elf/bin:/opt/esp/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-2021r2-patch3-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.11.0-esp32-20220706/openocd-esp32/bin:/opt/esp/python_env/idf4.3_py3.8_env/bin:/opt/esp/idf/tools:$PATH
  107. ENV GCC_TOOLS_BASE="/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-"
  108. ENV IDF_PATH="/opt/esp/idf"
  109. ENV IDF_PYTHON_ENV_PATH="/opt/esp/python_env/idf4.3_py3.8_env"
  110. ENV IDF_TOOLS_EXPORT_CMD="/opt/esp/idf/export.sh"
  111. ENV IDF_TOOLS_INSTALL_CMD="/opt/esp/idf/install.sh"
  112. ENV IDF_TOOLS_PATH="/opt/esp"
  113. ENV NODE_PATH="/v8/lib/node_modules"
  114. ENV NODE_VERSION="8"
  115. ENV OPENOCD_SCRIPTS="/opt/esp/tools/openocd-esp32/v0.10.0-esp32-20211111/openocd-esp32/share/openocd/scripts"
  116. # Ccache is installed, enable it by default
  117. # The constraint file has been downloaded and the right Python package versions installed. No need to check and
  118. # download this at every invocation of the container.
  119. ENV IDF_PYTHON_CHECK_CONSTRAINTS=no
  120. # Ccache is installed, enable it by default
  121. ENV IDF_CCACHE_ENABLE=1
  122. # Install QEMU runtime dependencies
  123. RUN : \
  124. && apt-get update && apt-get install -y -q \
  125. libglib2.0-0 \
  126. libpixman-1-0 \
  127. && rm -rf /var/lib/apt/lists/* \
  128. && :
  129. # Install QEMU
  130. ARG QEMU_VER=esp-develop-20220919
  131. ARG QEMU_DIST=qemu-${QEMU_VER}.tar.bz2
  132. ARG QEMU_SHA256=f6565d3f0d1e463a63a7f81aec94cce62df662bd42fc7606de4b4418ed55f870
  133. RUN : \
  134. && wget --no-verbose https://github.com/espressif/qemu/releases/download/${QEMU_VER}/${QEMU_DIST} \
  135. && echo "${QEMU_SHA256} *${QEMU_DIST}" | sha256sum --check --strict - \
  136. && tar -xf ${QEMU_DIST} -C /opt \
  137. && rm ${QEMU_DIST} \
  138. && :
  139. COPY docker/entrypoint.sh /opt/esp/entrypoint.sh
  140. COPY components/wifi-manager/webapp/package.json /opt
  141. ENV NODE_VERSION 8
  142. SHELL ["/bin/bash", "--login", "-c"]
  143. # Install nvm with node and npm
  144. # RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
  145. # && export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" \
  146. # && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
  147. # && nvm install $NODE_VERSION \
  148. # && nvm alias default $NODE_VERSION \
  149. # && nvm use default \
  150. # && echo installing nodejs version 16 \
  151. # && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
  152. # && echo installing node modules \
  153. # && cd /opt \
  154. # && nvm use default \
  155. # && npm install -g \
  156. # && :
  157. RUN : \
  158. && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
  159. && apt-get install -y nodejs jq \
  160. && echo installing dev node modules globally \
  161. && cd /opt \
  162. && cat ./package.json | jq '.devDependencies | keys[] as $k | "\($k)@\(.[$k])"' | xargs -t npm install --global \
  163. && echo installing npm global packages \
  164. && npm i -g npm \
  165. && node --version \
  166. && npm install -g \
  167. && :
  168. RUN : \
  169. && npm install -g html-webpack-plugin
  170. ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
  171. ENV PATH $IDF_PYTHON_ENV_PATH:$NVM_DIR/v$NODE_VERSION/bin:$PATH
  172. COPY ./docker/build_tools.py /usr/sbin/build_tools.py
  173. RUN : \
  174. && echo Changing permissions ******************************************************** \
  175. && chmod +x /opt/esp/entrypoint.sh \
  176. && chmod +x /usr/sbin/build_tools.py \
  177. && :
  178. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  179. CMD [ "/bin/bash" ]