2021-08-09 03:23:25 -04:00
|
|
|
FROM ubuntu:20.04
|
2019-07-02 12:36:12 -04:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2020-09-01 14:50:00 -04:00
|
|
|
# We need libpython2.7 due to GDB tools
|
2021-08-13 03:11:42 -04:00
|
|
|
RUN : \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y \
|
2019-07-02 12:36:12 -04:00
|
|
|
apt-utils \
|
|
|
|
bison \
|
|
|
|
ca-certificates \
|
|
|
|
ccache \
|
|
|
|
check \
|
|
|
|
curl \
|
|
|
|
flex \
|
|
|
|
git \
|
|
|
|
gperf \
|
|
|
|
lcov \
|
2021-08-13 03:11:42 -04:00
|
|
|
libffi-dev \
|
2019-07-02 12:36:12 -04:00
|
|
|
libncurses-dev \
|
2021-08-13 03:11:42 -04:00
|
|
|
libpython2.7 \
|
2019-07-02 12:36:12 -04:00
|
|
|
libusb-1.0-0-dev \
|
|
|
|
make \
|
|
|
|
ninja-build \
|
|
|
|
python3 \
|
|
|
|
python3-pip \
|
|
|
|
unzip \
|
|
|
|
wget \
|
|
|
|
xz-utils \
|
|
|
|
zip \
|
2021-08-13 03:11:42 -04:00
|
|
|
&& apt-get autoremove -y \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
|
|
|
|
&& python -m pip install --upgrade \
|
|
|
|
pip \
|
|
|
|
virtualenv \
|
|
|
|
&& :
|
2019-07-02 12:36:12 -04:00
|
|
|
|
|
|
|
# To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
|
|
|
|
# To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
|
|
|
|
# It is possibe to combine both, e.g.:
|
|
|
|
# IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
|
|
|
|
# IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
|
2022-05-25 19:03:01 -04:00
|
|
|
# Use IDF_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules)
|
|
|
|
# Use IDF_INSTALL_TARGETS to install tools only for selected chip targets (CSV)
|
2019-07-02 12:36:12 -04:00
|
|
|
|
|
|
|
ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
|
|
|
|
ARG IDF_CLONE_BRANCH_OR_TAG=master
|
|
|
|
ARG IDF_CHECKOUT_REF=
|
2022-05-25 19:03:01 -04:00
|
|
|
ARG IDF_CLONE_SHALLOW=
|
|
|
|
ARG IDF_INSTALL_TARGETS=all
|
2019-07-02 12:36:12 -04:00
|
|
|
|
|
|
|
ENV IDF_PATH=/opt/esp/idf
|
|
|
|
ENV IDF_TOOLS_PATH=/opt/esp
|
|
|
|
|
|
|
|
RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
|
|
|
|
git clone --recursive \
|
2022-05-25 19:03:01 -04:00
|
|
|
${IDF_CLONE_SHALLOW:+--depth=1 --shallow-submodules} \
|
2019-07-02 12:36:12 -04:00
|
|
|
${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
|
|
|
|
$IDF_CLONE_URL $IDF_PATH && \
|
|
|
|
if [ -n "$IDF_CHECKOUT_REF" ]; then \
|
|
|
|
cd $IDF_PATH && \
|
2022-05-25 19:03:01 -04:00
|
|
|
if [ -n "$IDF_CLONE_SHALLOW" ]; then \
|
|
|
|
git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF}; \
|
|
|
|
fi && \
|
2019-07-02 12:36:12 -04:00
|
|
|
git checkout $IDF_CHECKOUT_REF && \
|
|
|
|
git submodule update --init --recursive; \
|
|
|
|
fi
|
|
|
|
|
2021-08-13 03:11:42 -04:00
|
|
|
# Install all the required tools
|
|
|
|
RUN : \
|
|
|
|
&& update-ca-certificates --fresh \
|
2022-05-25 19:03:01 -04:00
|
|
|
&& $IDF_PATH/tools/idf_tools.py --non-interactive install required --targets=${IDF_INSTALL_TARGETS} \
|
2020-01-24 13:11:56 -05:00
|
|
|
&& $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
|
|
|
|
&& $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
|
2021-08-13 03:11:42 -04:00
|
|
|
&& rm -rf $IDF_TOOLS_PATH/dist \
|
|
|
|
&& :
|
2019-07-02 12:36:12 -04:00
|
|
|
|
2020-01-24 13:12:22 -05:00
|
|
|
# Ccache is installed, enable it by default
|
|
|
|
ENV IDF_CCACHE_ENABLE=1
|
2019-07-02 12:36:12 -04:00
|
|
|
COPY entrypoint.sh /opt/esp/entrypoint.sh
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
|
|
|
|
CMD [ "/bin/bash" ]
|