2
0

Dockerfile 7.6 KB

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