2023-08-09 02:15:53 -04:00
|
|
|
FROM ubuntu:22.04
|
2019-07-02 12:36:12 -04:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
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 \
|
2023-09-14 01:55:24 -04:00
|
|
|
bzip2 \
|
2019-07-02 12:36:12 -04:00
|
|
|
ca-certificates \
|
|
|
|
ccache \
|
|
|
|
check \
|
|
|
|
curl \
|
|
|
|
flex \
|
|
|
|
git \
|
2022-08-16 03:33:31 -04:00
|
|
|
git-lfs \
|
2019-07-02 12:36:12 -04:00
|
|
|
gperf \
|
|
|
|
lcov \
|
2022-07-12 23:06:46 -04:00
|
|
|
libbsd-dev \
|
2021-08-13 03:11:42 -04:00
|
|
|
libffi-dev \
|
2023-09-14 01:55:24 -04:00
|
|
|
libglib2.0-0 \
|
2019-07-02 12:36:12 -04:00
|
|
|
libncurses-dev \
|
2023-09-14 01:55:24 -04:00
|
|
|
libpixman-1-0 \
|
2023-12-05 21:54:06 -05:00
|
|
|
libsdl2-2.0-0 \
|
2023-09-14 01:55:24 -04:00
|
|
|
libslirp0 \
|
2019-07-02 12:36:12 -04:00
|
|
|
libusb-1.0-0-dev \
|
|
|
|
make \
|
|
|
|
ninja-build \
|
|
|
|
python3 \
|
2022-05-25 09:06:13 -04:00
|
|
|
python3-venv \
|
2022-07-12 23:06:46 -04:00
|
|
|
ruby \
|
2019-07-02 12:36:12 -04:00
|
|
|
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 \
|
|
|
|
&& :
|
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.
|
2024-04-21 17:53:04 -04:00
|
|
|
# It is possible to combine both, e.g.:
|
2019-07-02 12:36:12 -04:00
|
|
|
# IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
|
|
|
|
# IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
|
2024-04-21 17:53:04 -04:00
|
|
|
# Use IDF_CLONE_SHALLOW=1 to perform shallow clone (i.e. --depth=1 --shallow-submodules)
|
2023-11-21 05:02:47 -05:00
|
|
|
# Use IDF_CLONE_SHALLOW_DEPTH=X to define the depth if IDF_CLONE_SHALLOW is used (i.e. --depth=X)
|
2022-05-25 19:03:01 -04:00
|
|
|
# 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=
|
2023-11-21 05:02:47 -05:00
|
|
|
ARG IDF_CLONE_SHALLOW_DEPTH=1
|
2022-05-25 19:03:01 -04:00
|
|
|
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
|
|
|
|
|
2023-02-28 05:19:24 -05:00
|
|
|
# install build essential needed for linux target apps, which is a preview target so it is installed with "all" only
|
|
|
|
RUN if [ "$IDF_INSTALL_TARGETS" = "all" ]; then \
|
|
|
|
apt-get update \
|
|
|
|
&& apt-get install -y build-essential \
|
|
|
|
&& apt-get autoremove -y \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* ; \
|
|
|
|
fi
|
|
|
|
|
2019-07-02 12:36:12 -04:00
|
|
|
RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
|
|
|
|
git clone --recursive \
|
2023-11-21 05:02:47 -05:00
|
|
|
${IDF_CLONE_SHALLOW:+--depth=${IDF_CLONE_SHALLOW_DEPTH} --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 && \
|
2023-10-19 06:44:54 -04:00
|
|
|
git config --system --add safe.directory $IDF_PATH && \
|
2019-07-02 12:36:12 -04:00
|
|
|
if [ -n "$IDF_CHECKOUT_REF" ]; then \
|
|
|
|
cd $IDF_PATH && \
|
2022-05-25 19:03:01 -04:00
|
|
|
if [ -n "$IDF_CLONE_SHALLOW" ]; then \
|
2023-11-21 05:02:47 -05:00
|
|
|
git fetch origin --depth=${IDF_CLONE_SHALLOW_DEPTH} --recurse-submodules ${IDF_CHECKOUT_REF}; \
|
2022-05-25 19:03:01 -04:00
|
|
|
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} \
|
2023-09-14 01:55:24 -04:00
|
|
|
&& $IDF_PATH/tools/idf_tools.py --non-interactive install qemu* --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
|
|
|
|
2024-02-28 04:31:32 -05:00
|
|
|
# Add get_idf as alias
|
|
|
|
RUN echo 'alias get_idf=". /opt/esp/idf/export.sh"' >> /root/.bashrc
|
|
|
|
|
2022-07-01 08:44:12 -04:00
|
|
|
# The constraint file has been downloaded and the right Python package versions installed. No need to check and
|
|
|
|
# download this at every invocation of the container.
|
|
|
|
ENV IDF_PYTHON_CHECK_CONSTRAINTS=no
|
|
|
|
|
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
|
|
|
|
2022-10-19 00:23:00 -04:00
|
|
|
COPY entrypoint.sh /opt/esp/entrypoint.sh
|
2024-04-21 17:53:04 -04:00
|
|
|
RUN chmod +x /opt/esp/entrypoint.sh
|
2019-07-02 12:36:12 -04:00
|
|
|
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
|
|
|
|
CMD [ "/bin/bash" ]
|