-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
113 lines (102 loc) · 3.61 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Copyright 2023 Blues Inc. All rights reserved.
# Use of this source code is governed by licenses granted by the
# copyright holder including that found in the LICENSE file.
# Build development environment
# docker build --file Dockerfile.arduino-cli --tag arduino-cli .
# Launch development environment
# docker run --entrypoint bash --interactive --rm --tty --volume "$(pwd)":/host-volume/ --workdir /host-volume/ arduino-cli
# Define global arguments
ARG ARDUINO_CLI_VERSION=0.34.2
ARG DEBIAN_FRONTEND="noninteractive"
ARG UID=1000
ARG USER="blues"
# POSIX compatible (Linux/Unix) base image
FROM debian:bookworm-slim
# Import global arguments
ARG ARDUINO_CLI_VERSION
ARG DEBIAN_FRONTEND
ARG UID
ARG USER
# Define local arguments
ARG BINDIR=/usr/local/bin
ARG ECHO_BC_FILE='$bcfile'
# Define environment variables
ENV ARDUINO_UPDATER_ENABLE_NOTIFICATION=false
# 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}\" \
"]
# Establish development environment
RUN ["dash", "-c", "\
apt-get update --quiet \
&& apt-get install --assume-yes --no-install-recommends --quiet \
bash \
bash-completion \
ca-certificates \
curl \
g++ \
gdb \
git \
gzip \
lcov \
nano \
python-is-python3 \
python3 \
python3-pip \
ssh \
tree \
valgrind \
&& pip install --break-system-packages \
adafruit-nrfutil \
pyserial \
&& apt-get clean \
&& apt-get purge \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
"]
# Download/Install Arduino CLI
RUN ["dash", "-c", "\
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=${BINDIR} sh -s ${ARDUINO_CLI_VERSION} \
&& mkdir -p /etc/bash_completion.d/ \
&& arduino-cli completion bash > /etc/bash_completion.d/arduino-cli.sh \
&& echo >> /etc/bash.bashrc \
&& echo \"for bcfile in /etc/bash_completion.d/* ; do\" >> /etc/bash.bashrc \
&& echo \" [ -f \\\"${ECHO_BC_FILE}\\\" ] && . \\\"${ECHO_BC_FILE}\\\"\" >> /etc/bash.bashrc \
&& echo \"done\" >> /etc/bash.bashrc \
&& echo \"if [ -f /etc/bash_completion ]; then\" >> /etc/bash.bashrc \
&& echo \" . /etc/bash_completion\" >> /etc/bash.bashrc \
&& echo \"fi\" >> /etc/bash.bashrc \
"]
# Configure Arduino CLI
USER ${USER}
RUN ["dash", "-c", "\
arduino-cli config init \
&& arduino-cli config add board_manager.additional_urls \
https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json \
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json \
https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json \
https://raw.githubusercontent.com/adafruit/arduino-board-index/gh-pages/package_adafruit_index.json \
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json \
&& arduino-cli core update-index \
&& arduino-cli core install adafruit:nrf52 \
&& arduino-cli core install adafruit:samd \
&& arduino-cli core install arduino:avr \
&& arduino-cli core install arduino:mbed_nano \
&& arduino-cli core install arduino:samd \
&& arduino-cli core install esp32:esp32 \
&& arduino-cli core install rp2040:rp2040 \
&& arduino-cli core install SparkFun:apollo3 \
&& arduino-cli core install STMicroelectronics:stm32 \
&& arduino-cli lib install \"Blues Wireless Notecard Pseudo Sensor\" \
"]