-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy patharduino.dockerfile
executable file
·79 lines (67 loc) · 2.33 KB
/
arduino.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
#!/usr/bin/env -S docker build --compress -t pvtmert/arduino -f
FROM debian:stable
RUN apt update
RUN apt install -y \
arduino \
curl \
python \
python3-pip \
python3-serial \
xvfb \
--no-install-recommends
WORKDIR /data
ARG VERSION=0.6.0
RUN mkdir -p /usr/local/bin
RUN curl -#Lk "https://github.com/arduino/arduino-cli/releases/download/${VERSION}/arduino-cli_${VERSION}_Linux_64bit.tar.gz" \
| tar -xzC /usr/local/bin
RUN curl -skL https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls \
| grep -oE '"http(s)?://[^"]+\.json"' \
| tr -d '"' \
| xargs -n1 -P$(nproc) -I% -- bash -c 'curl -Ifsm1 "%" | grep -qi "application/json" && echo "%"' \
| sort -u \
| grep -vi \
-e rfduino.com \
-e zoubworld.com \
-e www.dwengo.org \
-e package_redbear_index.json \
| tee /urls.txt
# | tr -s \\n , \
RUN echo "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" \
| tee -a /urls.txt
RUN arduino-cli -v config init
RUN sed -i'' 's#board_manager: {}#board_manager:\n additional_urls:#g' \
~/.arduino15/arduino-cli.yaml
RUN sed 's:^: - :g' /urls.txt \
| tee -a ~/.arduino15/arduino-cli.yaml
RUN arduino-cli -v core update-index
RUN arduino-cli -v lib update-index
ENV BOARDS "arduino:avr"
ENV LIBRARIES "SD TFT GSM Servo Keyboard Esplora Firmata LiquidCrystal Ethernet ArduinoBLE"
RUN ( \
arduino-cli -v core install ${BOARDS} ; \
arduino-cli -v lib install ${LIBRARIES} ; \
)
RUN echo 'void setup() { }; void loop() { };' | tee -a /tmp/tmp.ino
ENV BOARD "arduino:avr:uno"
ENV PARAMS "_dummy=yes"
CMD ( \
arduino-cli -v core install ${BOARDS} ; \
arduino-cli -v lib install ${LIBRARIES} ; \
arduino-cli -v board details ${BOARD} ; \
find . -iname libs.txt -exec cat {} + \
| grep -viE '^http' \
| tr \\n \\0 \
| xargs -0 -- arduino-cli -v lib install ; \
find . -iname libs.txt -exec cat {} + \
| grep -iE '^http' \
| tr \\n \\0 \
| xargs -0 -n1 -I% -- \
bash -c 'curl -#Lk "%" | tar -xzC ~/Arduino/libraries' ; \
arduino-cli -v compile -b "${BOARD}" --show-properties /tmp ; \
arduino-cli -v compile -o "out.${BOARD}.bin" \
--build-properties "${PARAMS}" \
--build-path "$(pwd)/.build" \
--warnings "default" \
--fqbn "${BOARD}" \
"$(dirname "$(find "$(pwd)" -iname "*.ino" | sort | head -1)")" ; \
)