-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitpod.Dockerfile.thingy91
137 lines (131 loc) · 5.45 KB
/
.gitpod.Dockerfile.thingy91
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
FROM ubuntu:20.04 as base
WORKDIR /workdir
ARG arch=amd64
# System dependencies
RUN mkdir /workdir/project && \
mkdir /workdir/.cache && \
apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install \
wget \
python3-pip \
python3-venv \
ninja-build \
gperf \
git \
unzip \
libncurses5 libncurses5-dev \
libyaml-dev libfdt1 \
libusb-1.0-0-dev udev \
device-tree-compiler=1.5.1-1 \
ruby && \
apt-get -y clean && apt-get -y autoremove && \
#
# Latest PIP & Python dependencies
#
python3 -m pip install -U pip && \
python3 -m pip install -U pipx && \
python3 -m pip install -U setuptools && \
python3 -m pip install 'cmake>=3.20.0' wheel && \
python3 -m pip install -U 'west==0.14.0' && \
python3 -m pip install pc_ble_driver_py && \
# Newer PIP will not overwrite distutils, so upgrade PyYAML manually
python3 -m pip install --ignore-installed -U PyYAML && \
#
# Isolated command line tools
# No nrfutil 6+ release for arm64 (M1/M2 Macs) and Python 3, yet: https://github.com/NordicSemiconductor/pc-ble-driver-py/issues/227
#
case $arch in \
"amd64") \
PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin \
pipx install 'nrfutil>=6.0.0' \
;; \
esac && \
#
# ClangFormat
#
python3 -m pip install -U six && \
apt-get -y install clang-format-9 && \
ln -s /usr/bin/clang-format-9 /usr/bin/clang-format && \
wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/main/.clang-format > /workdir/.clang-format && \
#
# Nordic command line tools
# Releases: https://www.nordicsemi.com/Products/Development-tools/nrf-command-line-tools/download
#
echo "Target architecture: $arch" && \
case $arch in \
"amd64") \
NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-17-3/nrf-command-line-tools-10.17.3_Linux-amd64.tar.gz" \
;; \
"arm64") \
NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-17-3/nrf-command-line-tools-10.17.3_Linux-arm64.tar.gz" \
;; \
esac && \
# Releases: https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download
if [ ! -z "$NCLT_URL" ]; then \
mkdir tmp && cd tmp && \
wget -qO - "${NCLT_URL}" | tar --no-same-owner -xz && \
# Install included JLink
DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb && \
# Install nrf-command-line-tools
cp -r ./nrf-command-line-tools /opt && \
ln -s /opt/nrf-command-line-tools/bin/nrfjprog /usr/local/bin/nrfjprog && \
ln -s /opt/nrf-command-line-tools/bin/mergehex /usr/local/bin/mergehex && \
cd .. && rm -rf tmp ; \
else \
echo "Skipping nRF Command Line Tools (not available for $arch)" ; \
fi && \
#
# Zephyr Toolchain
# Releases: https://github.com/zephyrproject-rtos/sdk-ng/releases
#
echo "Target architecture: $arch" && \
case $arch in \
"amd64") \
ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/zephyr-sdk-0.15.1_linux-x86_64.tar.gz" \
;; \
"arm64") \
ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/zephyr-sdk-0.15.1_macos-aarch64.tar.gz" \
;; \
*) \
echo "Unsupported target architecture: \"$arch\"" >&2 && \
exit 1 ;; \
esac && \
wget -qO - "${ZEPHYR_TOOLCHAIN_URL}" | tar xz && \
mv /workdir/zephyr-sdk-0.15.1 /workdir/zephyr-sdk && cd /workdir/zephyr-sdk && yes | ./setup.sh
# Download sdk-nrf and west dependencies to install pip requirements
FROM base
ARG sdk_nrf_revision=main
RUN \
mkdir tmp && cd tmp && \
west init -m https://github.com/nrfconnect/sdk-nrf --mr ${sdk_nrf_revision} && \
west update --narrow -o=--depth=1 && \
echo "Installing requirements: zephyr/scripts/requirements.txt" && \
python3 -m pip install -r zephyr/scripts/requirements.txt && \
case $sdk_nrf_revision in \
"v1.4-branch") \
echo "Installing requirements: nrf/scripts/requirements.txt" && \
python3 -m pip install -r nrf/scripts/requirements.txt \
;; \
*) \
# Install only the requirements needed for building firmware, not documentation
echo "Installing requirements: nrf/scripts/requirements-base.txt" && \
python3 -m pip install -r nrf/scripts/requirements-base.txt && \
echo "Installing requirements: nrf/scripts/requirements-build.txt" && \
python3 -m pip install -r nrf/scripts/requirements-build.txt \
;; \
esac && \
echo "Installing requirements: bootloader/mcuboot/scripts/requirements.txt" && \
python3 -m pip install -r bootloader/mcuboot/scripts/requirements.txt && \
cd .. # && rm -rf tmp
WORKDIR /workdir/project
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV XDG_CACHE_HOME=/workdir/.cache
ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr
ENV ZEPHYR_SDK_INSTALL_DIR=/workdir/zephyr-sdk
ENV ZEPHYR_BASE=/workdir/project/zephyr
ENV PATH="${ZEPHYR_BASE}/scripts:${PATH}"
# Create the gitpod user. UID must be 33333.
RUN useradd -l -u 33333 -G sudo -md /home/gitpod -s /bin/bash -p gitpod gitpod
USER gitpod