From 04cdb68ed24d96d9e2416e4031da32c9e66111dc Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 12 Oct 2018 13:57:27 +0200 Subject: [PATCH] build: unify build-docker.sh and build-docker.gcc_source.sh --- .dockerignore | 1 + Dockerfile | 8 ++++---- Dockerfile.gcc_source | 6 +++++- build-docker.gcc_source.sh | 15 --------------- build-docker.sh | 12 ++++++++++-- 5 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 .dockerignore delete mode 100755 build-docker.gcc_source.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..50f751212 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +_attic/ diff --git a/Dockerfile b/Dockerfile index 7fe152768..c3a005ea7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,14 +18,14 @@ ENV TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/$TOOL RUN cd /opt && wget $TOOLCHAIN_URL && tar xfj $TOOLCHAIN_LONGVER-$TOOLCHAIN_FLAVOR.tar.bz2 -# setup toolchain - -ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH - # install additional tools RUN apt-get install -y protobuf-compiler libprotobuf-dev +# setup toolchain + +ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH + # install python tools RUN pip3 install click pyblake2 scons protobuf diff --git a/Dockerfile.gcc_source b/Dockerfile.gcc_source index dddc54201..9f51aa28a 100644 --- a/Dockerfile.gcc_source +++ b/Dockerfile.gcc_source @@ -26,13 +26,17 @@ RUN cd /opt/$TOOLCHAIN_LONGVER && ./install-sources.sh --skip_steps=mingw32 RUN cd /opt/$TOOLCHAIN_LONGVER && ./build-prerequisites.sh --skip_steps=mingw32 RUN cd /opt/$TOOLCHAIN_LONGVER && ./build-toolchain.sh --skip_steps=mingw32,manual +# install additional tools + +RUN apt-get install -y protobuf-compiler libprotobuf-dev + # setup toolchain ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH # install python tools -RUN pip3 install click pyblake2 scons +RUN pip3 install click pyblake2 scons protobuf RUN pip3 install --no-deps git+https://github.com/trezor/python-trezor.git@master # workarounds for weird default install diff --git a/build-docker.gcc_source.sh b/build-docker.gcc_source.sh deleted file mode 100755 index 6d20468c6..000000000 --- a/build-docker.gcc_source.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -IMAGE=trezor-core-build.gcc_source -TAG=${1:-master} - -docker build -t $IMAGE -f Dockerfile.gcc_source . - -docker run -t -v $(pwd)/build-docker:/build:z $IMAGE /bin/sh -c "\ - git clone https://github.com/trezor/trezor-core && \ - cd trezor-core && \ - ln -s /build build && - git checkout $TAG && \ - git submodule update --init --recursive && \ - make clean vendor build_boardloader build_bootloader build_prodtest build_firmware" diff --git a/build-docker.sh b/build-docker.sh index decafdf47..b1b5897a0 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,7 +1,15 @@ #!/bin/bash set -e -IMAGE=trezor-core-build +if [ "$1" = "--gcc_source" ]; then + DOCKERFILE=Dockerfile.gcc_source + IMAGE=trezor-core-build.gcc_source + shift +else + DOCKERFILE=Dockerfile + IMAGE=trezor-core-build +fi + TAG=${1:-master} REPOSITORY=${2:-trezor} @@ -11,7 +19,7 @@ else REPOSITORY=https://github.com/$REPOSITORY/trezor-core.git fi -docker build -t $IMAGE . +docker build -t $IMAGE -f $DOCKERFILE . docker run -t -v $(pwd):/local -v $(pwd)/build-docker:/build:z $IMAGE /bin/sh -c "\ git clone $REPOSITORY trezor-core && \