-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
69 lines (52 loc) · 1.67 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
FROM debian:9
ARG OS_NAME=linux
ENV OS_NAME=$OS_NAME
# install build tools and dependencies
RUN apt-get update && \
apt-get install -y \
build-essential \
curl \
unzip\
python3 \
python3-pip \
python-protobuf \
wget \
libusb-1.0.0-dev \
cmake \
udev \
git \
sudo
RUN python3 -m pip uninstall pip && \
apt-get install python3-pip --reinstall
# download toolchain
ENV TOOLCHAIN_SHORTVER=6-2017q2
ENV TOOLCHAIN_LONGVER=gcc-arm-none-eabi-6-2017-q2-update
ENV TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/$TOOLCHAIN_SHORTVER/$TOOLCHAIN_LONGVER-$OS_NAME.tar.bz2
# extract toolchain
RUN cd /opt && \
wget $TOOLCHAIN_URL && \
tar xfj $TOOLCHAIN_LONGVER-$OS_NAME.tar.bz2
# download protobuf
ENV PROTOBUF_VERSION=3.6.1
RUN wget "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
ENV STLINK_VERSION=1.5.0
RUN wget "https://github.com/texane/stlink/archive/v${STLINK_VERSION}.zip"
# setup toolchain
ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH
ENV PYTHON=python3
ENV PIP=pip3
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# use zipfile module to extract files world-readable
RUN $PYTHON -m zipfile -e "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" /usr/local && \
chmod 755 /usr/local/bin/protoc
RUN $PYTHON -m zipfile -e "v1.5.0.zip" /tmp && \
cd /tmp/stlink-1.5.0 && \
make release && \
cd build/Release && \
make install && \
ldconfig
RUN useradd -m user
USER user
RUN $PYTHON -m pip install --user "protobuf==3.6.1" ecdsa "setuptools==49.6.0"