-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile
94 lines (82 loc) · 2.37 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Build development environment
# docker build --tag esp-dev-env .
# Launch development environment
# docker run --device /dev/bus/usb/ --interactive --rm --tty --volume "$(pwd)":/host-volume/ esp-dev-env
# _**NOTE:** In order to utilize DFU and debugging functionality, you must
# install (copy) the `.rules` file related to your debugging probe into the
# `/etc/udev/rules.d` directory of the host machine and restart the host._
# _**NOTE:** The debugging probe must be attached while the container is
# launched in order for it to be accessible from inside the container._
# Define global arguments
ARG DEBIAN_FRONTEND="noninteractive"
ARG UID=1000
ARG USER=maker
# POSIX compatible (Linux/Unix) base image
FROM debian:stable-slim
# Import global arguments
ARG DEBIAN_FRONTEND
ARG UID
ARG USER
# Define local arguments
# Create Non-Root User
RUN ["dash", "-c", "\
addgroup \
--gid ${UID} \
\"${USER}\" \
&& adduser \
--disabled-password \
--gecos \"\" \
--ingroup \"${USER}\" \
--uid ${UID} \
\"${USER}\" \
&& usermod \
--append \
--groups \"dialout,plugdev\" \
\"${USER}\" \
"]
ENV PATH="/home/${USER}/.local/bin:${PATH}"
# Step 1. Install Prerequisites
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-setup.html#install-prerequisites
RUN ["dash", "-c", "\
apt-get update --quiet \
&& apt-get install --assume-yes --no-install-recommends --quiet \
bison \
ccache \
cmake \
dfu-util \
flex \
git \
gperf \
libffi-dev \
libpython2.7 \
libssl-dev \
libusb-1.0-0 \
nano \
ninja-build \
python3 \
python3-pip \
python3-setuptools \
python3-venv \
udev \
wget \
&& apt-get clean \
&& apt-get purge \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
"]
# Install IDF as non-root user
WORKDIR /home/${USER}/
USER ${USER}
# Step 2. Get ESP-IDF
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-2-get-esp-idf
RUN ["dash", "-c", "\
mkdir esp \
&& cd esp/ \
&& git clone --recursive https://github.com/espressif/esp-idf.git --branch v5.0 \
"]
# Step 3. Set up the tools
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-3-set-up-the-tools
ENV IDF_TARGET="esp32"
RUN ["dash", "-c", "\
cd ./esp/esp-idf \
&& ./install.sh ${IDF_TARGET} \
"]