-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
54 lines (42 loc) · 1.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM debian:bullseye
# dependencies
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-setup.html
RUN apt-get update && apt-get install -y \
git wget flex bison gperf \
python3 python3-pip python3-setuptools \
cmake ninja-build ccache dfu-util \
libffi-dev libssl-dev libusb-1.0-0
# SDK
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#linux-and-macos
ARG ESP_IDF_VERSION
ENV IDF_PATH=/opt/esp-idf
RUN \
git clone --branch $ESP_IDF_VERSION --depth 1 https://github.com/espressif/esp-idf.git /opt/esp-idf && \
git -C /opt/esp-idf submodule update --init --recursive
# SDK tools
ARG ESP_IDF_TARGETS=esp32
ENV \
IDF_TOOLS_PATH=/opt/esp-idf-tools \
ESP_PYTHON=python3
# install.sh
RUN ${ESP_PYTHON} /opt/esp-idf/tools/idf_tools.py --non-interactive install --targets=${ESP_IDF_TARGETS}
RUN ${ESP_PYTHON} /opt/esp-idf/tools/idf_tools.py --non-interactive install-python-env
# export.sh
RUN ${ESP_PYTHON} /opt/esp-idf/tools/idf_tools.py --non-interactive export > /opt/esp-idf-envs.sh
RUN . /opt/esp-idf-envs.sh && ${ESP_PYTHON} /opt/esp-idf/tools/check_python_dependencies.py
ADD entrypoint.sh /opt/esp-idf-entrypoint.sh
ENTRYPOINT ["/opt/esp-idf-entrypoint.sh"]
# custom patches
COPY patches/ /tmp/patches
RUN \
for patch in /tmp/patches/*.patch; do \
echo "Applying ${patch##*/}..."; \
patch -d $IDF_PATH -p1 < "$patch" || exit 1; \
done
# build
ARG BUILD_UID
ARG BUILD_GID
RUN groupadd --gid $BUILD_GID build && useradd -d /build -g $BUILD_GID -G dialout -u $BUILD_UID build
RUN git config --system --add safe.directory '*'
USER build
WORKDIR /build