From b6a7c437c8de4168ed7ae77b88a42bc586b0c517 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Mon, 4 Mar 2019 16:29:11 +0100 Subject: [PATCH] Separate production and test docker --- .gitlab-ci.yml | 2 +- Dockerfile | 53 ++++++++++--------------------------------------- Dockerfile.test | 50 ++++++++++++++++++++++++++++++++++++++++++++++ test/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 44 deletions(-) create mode 100644 Dockerfile.test create mode 100644 test/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3046d582..88677518 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -168,7 +168,7 @@ integration tests: script: - 'export SHARED_PATH="$(dirname ${CI_PROJECT_DIR})/shared"' - rm -r ${SHARED_PATH} || true - - docker build -t wallet-emulator-bridge-tests . + - docker build -f Dockerfile.test -t wallet-emulator-bridge-tests . - mkdir -p ${SHARED_PATH}/trezor-wallet/screenshots - mkdir -p ${SHARED_PATH}/trezor-wallet/videos - docker run --volume ${SHARED_PATH}/trezor-wallet/screenshots:/trezor-wallet/test/screenshots --volume ${SHARED_PATH}/trezor-wallet/videos:/trezor-wallet/test/videos --rm wallet-emulator-bridge-tests diff --git a/Dockerfile b/Dockerfile index 06d122b5..7a128d5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,17 @@ -FROM python:latest +FROM node:10.15.1 -# -# setup -# -RUN apt-get update -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - -RUN apt-get install -y chromium libappindicator3-1 xdg-utils fonts-liberation nodejs wget dpkg git python python3 python3-pip xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 -RUN npm install -g yarn +ARG BUILD_TYPE=stable -RUN ln -s /usr/bin/chromium /usr/local/bin/chromium-browser +WORKDIR /trezor-wallet-app -# -# build emulator -# -RUN mkdir /trezor-emulator -WORKDIR /trezor-emulator +COPY package.json /trezor-wallet-app +COPY yarn.lock /trezor-wallet-app -RUN git clone https://github.com/trezor/trezor-core -WORKDIR /trezor-emulator/trezor-core -RUN git submodule update --init --recursive +RUN yarn install -RUN apt-get install libusb-1.0-0 -RUN pip3 install scons trezor -RUN make build_unix_noui +COPY . /trezor-wallet-app -# -# install bridge -# -RUN mkdir /trezor-bridge -WORKDIR /trezor-bridge -RUN wget https://wallet.trezor.io/data/bridge/2.0.25/trezor-bridge_2.0.25_amd64.deb -RUN dpkg -x /trezor-bridge/trezor-bridge_2.0.25_amd64.deb /trezor-bridge/extracted +RUN yarn run build:${BUILD_TYPE} -# -# install trezor-wallet -# -RUN mkdir /trezor-wallet -WORKDIR /trezor-wallet -COPY package.json /trezor-wallet -COPY yarn.lock /trezor-wallet -RUN yarn -COPY . /trezor-wallet -RUN yarn run build:stable - -# -# run -# -ENTRYPOINT ["/trezor-wallet/test/scripts/run-all.sh"] -EXPOSE 8080 21325 \ No newline at end of file +EXPOSE 8080 +CMD [ "yarn", "run", "prod-server" ] \ No newline at end of file diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 00000000..06d122b5 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,50 @@ +FROM python:latest + +# +# setup +# +RUN apt-get update +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - +RUN apt-get install -y chromium libappindicator3-1 xdg-utils fonts-liberation nodejs wget dpkg git python python3 python3-pip xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 +RUN npm install -g yarn + +RUN ln -s /usr/bin/chromium /usr/local/bin/chromium-browser + +# +# build emulator +# +RUN mkdir /trezor-emulator +WORKDIR /trezor-emulator + +RUN git clone https://github.com/trezor/trezor-core +WORKDIR /trezor-emulator/trezor-core +RUN git submodule update --init --recursive + +RUN apt-get install libusb-1.0-0 +RUN pip3 install scons trezor +RUN make build_unix_noui + +# +# install bridge +# +RUN mkdir /trezor-bridge +WORKDIR /trezor-bridge +RUN wget https://wallet.trezor.io/data/bridge/2.0.25/trezor-bridge_2.0.25_amd64.deb +RUN dpkg -x /trezor-bridge/trezor-bridge_2.0.25_amd64.deb /trezor-bridge/extracted + +# +# install trezor-wallet +# +RUN mkdir /trezor-wallet +WORKDIR /trezor-wallet +COPY package.json /trezor-wallet +COPY yarn.lock /trezor-wallet +RUN yarn +COPY . /trezor-wallet +RUN yarn run build:stable + +# +# run +# +ENTRYPOINT ["/trezor-wallet/test/scripts/run-all.sh"] +EXPOSE 8080 21325 \ No newline at end of file diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 00000000..06d122b5 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,50 @@ +FROM python:latest + +# +# setup +# +RUN apt-get update +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - +RUN apt-get install -y chromium libappindicator3-1 xdg-utils fonts-liberation nodejs wget dpkg git python python3 python3-pip xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 +RUN npm install -g yarn + +RUN ln -s /usr/bin/chromium /usr/local/bin/chromium-browser + +# +# build emulator +# +RUN mkdir /trezor-emulator +WORKDIR /trezor-emulator + +RUN git clone https://github.com/trezor/trezor-core +WORKDIR /trezor-emulator/trezor-core +RUN git submodule update --init --recursive + +RUN apt-get install libusb-1.0-0 +RUN pip3 install scons trezor +RUN make build_unix_noui + +# +# install bridge +# +RUN mkdir /trezor-bridge +WORKDIR /trezor-bridge +RUN wget https://wallet.trezor.io/data/bridge/2.0.25/trezor-bridge_2.0.25_amd64.deb +RUN dpkg -x /trezor-bridge/trezor-bridge_2.0.25_amd64.deb /trezor-bridge/extracted + +# +# install trezor-wallet +# +RUN mkdir /trezor-wallet +WORKDIR /trezor-wallet +COPY package.json /trezor-wallet +COPY yarn.lock /trezor-wallet +RUN yarn +COPY . /trezor-wallet +RUN yarn run build:stable + +# +# run +# +ENTRYPOINT ["/trezor-wallet/test/scripts/run-all.sh"] +EXPOSE 8080 21325 \ No newline at end of file