1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 00:48:19 +00:00
trezor-firmware/ci/Dockerfile

110 lines
3.9 KiB
Docker
Raw Normal View History

2017-11-04 00:56:05 +00:00
# initialize from the image
2019-05-27 12:08:47 +00:00
FROM python:3.7.3
2017-11-04 00:56:05 +00:00
2018-10-12 12:13:39 +00:00
ARG TOOLCHAIN_FLAVOR=linux
ENV TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR
2017-11-04 00:56:05 +00:00
# install build tools and dependencies
RUN apt-get update && apt-get install -y \
build-essential wget git libsodium-dev graphviz \
valgrind check libssl-dev libusb-1.0-0-dev libudev-dev zlib1g-dev \
libsdl2-dev libsdl2-image-dev
2019-05-14 10:59:05 +00:00
# install clang-format 6 from backports
RUN echo "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list
# Install Python 3.5, 3.6 and 3.8 assuming we have 3.7 docker image
RUN wget https://www.python.org/ftp/python/3.5.7/Python-3.5.7.tgz
RUN tar zxf Python-3.5.7.tgz
RUN cd Python-3.5.7 && ./configure && make && make install
RUN wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
RUN tar zxf Python-3.6.9.tgz
RUN cd Python-3.6.9/ && ./configure && make && make install
RUN wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0b3.tgz
RUN tar zxf Python-3.8.0b3.tgz
RUN cd Python-3.8.0b3/ && ./configure && make && make install
2019-05-14 10:59:05 +00:00
RUN apt-get update && apt-get install -t stretch-backports -y clang-format-6.0
RUN ln -s clang-format-6.0 /usr/bin/clang-format
# TODO are all apt packages actually needed?
2017-11-04 00:56:05 +00:00
2018-10-12 12:13:39 +00:00
# install dependencies from toolchain source build
2018-10-23 10:00:42 +00:00
RUN if [ "$TOOLCHAIN_FLAVOR" = "src" ]; then \
apt-get install -y autoconf autogen bison dejagnu \
flex flip gawk git gperf gzip nsis \
openssh-client p7zip-full perl python-dev \
libisl-dev tcl tofrodos zip \
texinfo texlive texlive-extra-utils; \
fi
2018-10-12 12:13:39 +00:00
# download toolchain
ENV TOOLCHAIN_SHORTVER=8-2018q4
ENV TOOLCHAIN_LONGVER=gcc-arm-none-eabi-8-2018-q4-major
ENV TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/$TOOLCHAIN_SHORTVER/$TOOLCHAIN_LONGVER-$TOOLCHAIN_FLAVOR.tar.bz2
ENV TOOLCHAIN_HASH_linux=fb31fbdfe08406ece43eef5df623c0b2deb8b53e405e2c878300f7a1f303ee52
ENV TOOLCHAIN_HASH_src=bc228325dbbfaf643f2ee5d19e01d8b1873fcb9c31781b5e1355d40a68704ce7
# extract toolchain
RUN cd /opt && wget $TOOLCHAIN_URL
RUN cd /opt && echo "$TOOLCHAIN_HASH_linux $TOOLCHAIN_LONGVER-linux.tar.bz2\n$TOOLCHAIN_HASH_src $TOOLCHAIN_LONGVER-src.tar.bz2" | sha256sum -c --ignore-missing
RUN cd /opt && tar xfj $TOOLCHAIN_LONGVER-$TOOLCHAIN_FLAVOR.tar.bz2
2018-10-12 12:13:39 +00:00
# build toolchain (if required)
2018-10-23 10:00:42 +00:00
RUN if [ "$TOOLCHAIN_FLAVOR" = "src" ]; then \
pushd /opt/$TOOLCHAIN_LONGVER ; \
./install-sources.sh --skip_steps=mingw32 ; \
./build-prerequisites.sh --skip_steps=mingw32 ; \
./build-toolchain.sh --skip_steps=mingw32,manual ; \
popd ; \
fi
2018-10-12 12:13:39 +00:00
# download protobuf
2018-08-14 15:32:02 +00:00
ENV PROTOBUF_VERSION=3.4.0
ENV PROTOBUF_HASH=e4b51de1b75813e62d6ecdde582efa798586e09b5beaebfb866ae7c9eaadace4
RUN wget "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
RUN echo "${PROTOBUF_HASH} protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" | sha256sum -c
2018-08-14 15:32:02 +00:00
# setup toolchain
ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
# use zipfile module to extract files world-readable
2019-04-25 13:21:42 +00:00
ENV PYTHON=python
RUN $PYTHON -m zipfile -e "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" /usr/local && chmod 755 /usr/local/bin/protoc
2019-04-25 11:08:33 +00:00
ENV WORKON_HOME=/tmp/.venvs
2017-11-04 00:56:05 +00:00
# download monero tests binary
ENV TREZOR_MONERO_TESTS_SHA256SUM=140a16b3d6105b5e8e88a93b451e9600a36ed23928ea3cf2f975f9c83f36dab7
ENV TREZOR_MONERO_TESTS_URL="https://github.com/ph4r05/monero/releases/download/v0.14.1.0-tests-u14.04-01/trezor_tests"
ENV TREZOR_MONERO_TESTS_PATH="/opt/trezor_monero_tests"
RUN wget "$TREZOR_MONERO_TESTS_URL" -O "$TREZOR_MONERO_TESTS_PATH" \
&& chmod +x "$TREZOR_MONERO_TESTS_PATH"
RUN echo "${TREZOR_MONERO_TESTS_SHA256SUM} ${TREZOR_MONERO_TESTS_PATH}" | sha256sum -c
# install python dependencies
2017-11-04 00:56:05 +00:00
RUN pip install pipenv
2019-04-25 13:21:42 +00:00
RUN $PYTHON --version
RUN pip --version
RUN pipenv --version