Dockerfile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. FROM ubuntu:20.04
  2. ARG DEBIAN_FRONTEND=noninteractive
  3. # We need libpython2.7 due to GDB tools
  4. # we also need npm 8 for the webapp to work
  5. RUN : \
  6. && apt-get update \
  7. && apt-get install -y \
  8. apt-utils \
  9. bison \
  10. ca-certificates \
  11. ccache \
  12. check \
  13. curl \
  14. flex \
  15. git \
  16. gperf \
  17. lcov \
  18. libffi-dev \
  19. libncurses-dev \
  20. libpython2.7 \
  21. libusb-1.0-0-dev \
  22. make \
  23. ninja-build \
  24. python3 \
  25. python3-pip \
  26. unzip \
  27. wget \
  28. xz-utils \
  29. zip \
  30. npm \
  31. nodejs \
  32. && apt-get autoremove -y \
  33. && rm -rf /var/lib/apt/lists/* \
  34. && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
  35. && python -m pip install --upgrade \
  36. pip \
  37. virtualenv \
  38. && :
  39. # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
  40. # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
  41. # It is possibe to combine both, e.g.:
  42. # IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
  43. # IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
  44. # The following commit contains the ldgen fix: eab738c79e063b3d6f4c345ea5e1d4f8caef725b
  45. # to build an image using that commit: docker build . --build-arg IDF_CHECKOUT_REF=eab738c79e063b3d6f4c345ea5e1d4f8caef725b -t sle118/squeezelite-esp32-idfv4-master
  46. # docker build . --build-arg IDF_CHECKOUT_REF=8bf14a9238329954c7c5062eeeda569529aedf75 -t sle118/squeezelite-esp32-idfv4-master
  47. # To run the image interactive (windows): docker run --rm -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv4-master
  48. # to build the web app inside of the interactive session
  49. # pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd
  50. ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
  51. ARG IDF_CLONE_BRANCH_OR_TAG=master
  52. ARG IDF_CHECKOUT_REF=eab738c79e063b3d6f4c345ea5e1d4f8caef725b
  53. ENV IDF_PATH=/opt/esp/idf
  54. ENV IDF_TOOLS_PATH=/opt/esp
  55. RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
  56. git clone --recursive \
  57. ${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
  58. $IDF_CLONE_URL $IDF_PATH && \
  59. if [ -n "$IDF_CHECKOUT_REF" ]; then \
  60. cd $IDF_PATH && \
  61. git checkout $IDF_CHECKOUT_REF && \
  62. git submodule update --init --recursive; \
  63. fi
  64. COPY docker/patches $IDF_PATH
  65. # Install all the required tools
  66. RUN : \
  67. && update-ca-certificates --fresh \
  68. && $IDF_PATH/tools/idf_tools.py --non-interactive install required \
  69. && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
  70. && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
  71. && rm -rf $IDF_TOOLS_PATH/dist \
  72. && :
  73. # Ccache is installed, enable it by default
  74. ENV IDF_CCACHE_ENABLE=1
  75. COPY docker/entrypoint.sh /opt/esp/entrypoint.sh
  76. # Now install nodejs, npm and the packages we need
  77. COPY components/wifi-manager/webapp/package.json /opt
  78. ENV NODE_VERSION 8
  79. SHELL ["/bin/bash", "--login", "-c"]
  80. # Install nvm with node and npm
  81. # RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
  82. # && export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" \
  83. # && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
  84. # && nvm install $NODE_VERSION \
  85. # && nvm alias default $NODE_VERSION \
  86. # && nvm use default \
  87. # && echo installing nodejs version 16 \
  88. # && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
  89. # && echo installing node modules \
  90. # && cd /opt \
  91. # && nvm use default \
  92. # && npm install -g \
  93. # && :
  94. RUN : \
  95. && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
  96. && apt-get install -y nodejs \
  97. && echo installing node modules \
  98. && cd /opt \
  99. && npm i -g npm \
  100. && node --version \
  101. && npm install -g \
  102. && :
  103. ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
  104. ENV PATH $NVM_DIR/v$NODE_VERSION/bin:$PATH
  105. ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
  106. CMD [ "/bin/bash" ]