Skip to content

Commit

Permalink
Merge pull request #922 from UniqueNetwork/build/merge-941055-into-ma…
Browse files Browse the repository at this point in the history
…ster

Merge release 941055 into master
  • Loading branch information
kozyrevdev authored May 10, 2023
2 parents 87d25f4 + c134fe9 commit 6221fea
Show file tree
Hide file tree
Showing 138 changed files with 5,891 additions and 3,676 deletions.
40 changes: 40 additions & 0 deletions .docker/Dockerfile-chainql.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ===== Rust builder =====
FROM ubuntu:22.04 as rust-builder
LABEL maintainer="Unique.Network"

ENV CARGO_HOME="/cargo-home"
ENV PATH="/cargo-home/bin:$PATH"
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && \
apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \
apt-get clean && \
rm -r /var/lib/apt/lists/*

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none

RUN rustup toolchain uninstall $(rustup toolchain list) && \
rustup toolchain install {{ RUST_TOOLCHAIN }} && \
rustup default {{ RUST_TOOLCHAIN }} && \
rustup target list --installed && \
rustup show
RUN rustup target add wasm32-unknown-unknown --toolchain {{ RUST_TOOLCHAIN }}

RUN mkdir /unique_parachain
WORKDIR /unique_parachain

# ===== BUILD CHAINQL =====
FROM rust-builder as builder-chainql-bin

RUN mkdir chainql
WORKDIR /chainql

RUN git clone -b {{ CHAINQL }} --depth 1 https://github.com/UniqueNetwork/chainql.git . && \
cargo build --release

# ===== RUN ======

FROM ubuntu:22.04 as builder-chainql

COPY --from=builder-chainql-bin /chainql/target/release/chainql /chainql/target/release/chainql
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
ARG POLKADOT_BUILD_BRANCH
FROM uniquenetwork/builder-polkadot:${POLKADOT_BUILD_BRANCH} as polkadot
FROM uniquenetwork/builder-polkadot:{{ POLKADOT_BUILD_BRANCH }} as polkadot

# ===== Rust builder =====
FROM uniquenetwork/services:latest as rust-builder
ARG RUST_TOOLCHAIN=

ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN
ENV CARGO_HOME="/cargo-home"
ENV PATH="/cargo-home/bin:$PATH"
ENV TZ=UTC

RUN rustup toolchain uninstall $(rustup toolchain list) && \
rustup toolchain install $RUST_TOOLCHAIN && \
rustup default $RUST_TOOLCHAIN && \
rustup toolchain install {{ RUST_TOOLCHAIN }} && \
rustup default {{ RUST_TOOLCHAIN }} && \
rustup target list --installed && \
rustup show
RUN rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN
RUN rustup target add wasm32-unknown-unknown --toolchain {{ RUST_TOOLCHAIN }}

RUN mkdir /unique_parachain
WORKDIR /unique_parachain
Expand All @@ -24,36 +22,26 @@ WORKDIR /unique_parachain
FROM rust-builder as builder-unique-current

ARG PROFILE=release
ARG NETWORK
ARG MAINNET_BRANCH
ARG REPO_URL

WORKDIR /unique_parachain

RUN git clone $REPO_URL -b $MAINNET_BRANCH . && \
cargo build --features=${NETWORK}-runtime --$PROFILE
RUN git clone https://github.com/UniqueNetwork/unique-chain.git -b {{ MAINNET_BRANCH }} . && \
cargo build --features={{ NETWORK }}-runtime --$PROFILE

# ===== BUILD target version ======
FROM rust-builder as builder-unique-target

ARG PROFILE=release
ARG NETWORK
ARG BRANCH
ARG REPO_URL

COPY . /unique_parachain
WORKDIR /unique_parachain

RUN cargo build --features=${NETWORK}-runtime --$PROFILE
RUN cargo build --features={{ NETWORK }}-runtime --$PROFILE

# ===== RUN ======
FROM ubuntu:22.04

ARG NETWORK
ARG REPLICA_FROM
ENV REPLICA_FROM=${REPLICA_FROM}
ARG POLKADOT_LAUNCH_BRANCH
ARG WASM_NAME
ENV REPLICA_FROM={{ REPLICA_FROM }}

RUN apt-get -y update && \
apt-get -y install curl git && \
Expand All @@ -63,22 +51,23 @@ RUN apt-get -y update && \
nvm install v16.16.0 && \
nvm use v16.16.0

RUN git clone https://github.com/uniquenetwork/polkadot-launch.git -b ${POLKADOT_LAUNCH_BRANCH}
RUN git clone https://github.com/uniquenetwork/polkadot-launch.git -b {{ POLKADOT_LAUNCH_BRANCH }}

RUN export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
cd /polkadot-launch && \
npm install --global yarn && \
yarn install

RUN echo "$NETWORK"
RUN echo "$REPLICA_FROM"

COPY --from=builder-unique-current /unique_parachain/target/release/unique-collator /unique-chain/current/release/
COPY --from=builder-unique-target /unique_parachain/target/release/unique-collator /unique-chain/target/release/
COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/"$WASM_NAME"-runtime/"$WASM_NAME"_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/"$WASM_NAME"-runtime/"$WASM_NAME"_runtime.compact.compressed.wasm
COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm

COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/launch-config-forkless-data.json /polkadot-launch/launch-config.json
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/fork.jsonnet /polkadot-launch/fork.jsonnet
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/typeNames.jsonnet /polkadot-launch/typeNames.jsonnet

COPY --from=uniquenetwork/builder-chainql:latest /chainql/target/release/chainql /chainql/target/release/
COPY --from=uniquenetwork/builder-chainql:{{ CHAINQL }} /chainql/target/release/chainql /chainql/target/release/

COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
COPY --from=polkadot /unique_parachain/polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm /polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
ARG POLKADOT_BUILD_BRANCH
FROM uniquenetwork/builder-polkadot:${POLKADOT_BUILD_BRANCH} as polkadot
FROM uniquenetwork/builder-polkadot:{{ POLKADOT_BUILD_BRANCH }} as polkadot

# ===== Rust builder =====
FROM uniquenetwork/services:latest as rust-builder

ARG RUST_TOOLCHAIN=

ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN
ENV CARGO_HOME="/cargo-home"
ENV PATH="/cargo-home/bin:$PATH"
ENV TZ=UTC

RUN rustup toolchain uninstall $(rustup toolchain list) && \
rustup toolchain install $RUST_TOOLCHAIN && \
rustup default $RUST_TOOLCHAIN && \
rustup toolchain install {{ RUST_TOOLCHAIN }} && \
rustup default {{ RUST_TOOLCHAIN }} && \
rustup target list --installed && \
rustup show
RUN rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN
RUN rustup target add wasm32-unknown-unknown --toolchain {{ RUST_TOOLCHAIN }}

RUN mkdir /unique_parachain
WORKDIR /unique_parachain
Expand All @@ -24,33 +22,25 @@ WORKDIR /unique_parachain
FROM rust-builder as builder-unique-current

ARG PROFILE=release
ARG NETWORK
ARG MAINNET_BRANCH
ARG REPO_URL

WORKDIR /unique_parachain

RUN git clone $REPO_URL -b $MAINNET_BRANCH . && \
cargo build --features=${NETWORK}-runtime --$PROFILE
RUN git clone https://github.com/UniqueNetwork/unique-chain.git -b {{ MAINNET_BRANCH }} . && \
cargo build --features={{ NETWORK }}-runtime --$PROFILE

# ===== BUILD target version ======
FROM rust-builder as builder-unique-target

ARG PROFILE=release
ARG NETWORK

COPY . /unique_parachain
WORKDIR /unique_parachain

RUN cargo build --features=${NETWORK}-runtime --$PROFILE
RUN cargo build --features={{ NETWORK }}-runtime --$PROFILE

# ===== RUN ======
FROM ubuntu:22.04

ARG NETWORK
ARG POLKADOT_LAUNCH_BRANCH
ARG WASM_NAME

RUN apt-get -y update && \
apt-get -y install curl git && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
Expand All @@ -59,19 +49,19 @@ RUN apt-get -y update && \
nvm install v16.16.0 && \
nvm use v16.16.0

RUN git clone https://github.com/uniquenetwork/polkadot-launch -b ${POLKADOT_LAUNCH_BRANCH}
RUN git clone https://github.com/uniquenetwork/polkadot-launch -b {{ POLKADOT_LAUNCH_BRANCH }}

RUN export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
cd /polkadot-launch && \
npm install --global yarn && \
yarn install

RUN echo "$NETWORK"

COPY --from=builder-unique-current /unique_parachain/target/release/unique-collator /unique-chain/current/release/
COPY --from=builder-unique-target /unique_parachain/target/release/unique-collator /unique-chain/target/release/
COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/"$WASM_NAME"-runtime/"$WASM_NAME"_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/"$WASM_NAME"-runtime/"$WASM_NAME"_runtime.compact.compressed.wasm
COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm

COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/launch-config-forkless-nodata.json /polkadot-launch/launch-config.json

COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
COPY --from=polkadot /unique_parachain/polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm /polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm
Expand Down
41 changes: 0 additions & 41 deletions .docker/Dockerfile-try-runtime

This file was deleted.

32 changes: 32 additions & 0 deletions .docker/Dockerfile-try-runtime.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ===== Rust builder =====
FROM uniquenetwork/services:latest as rust-builder

ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN
ENV CARGO_HOME="/cargo-home"
ENV PATH="/cargo-home/bin:$PATH"
ENV TZ=UTC

RUN rustup toolchain uninstall $(rustup toolchain list) && \
rustup toolchain install {{ RUST_TOOLCHAIN }} && \
rustup default {{ RUST_TOOLCHAIN }} && \
rustup target list --installed && \
rustup show
RUN rustup target add wasm32-unknown-unknown --toolchain {{ RUST_TOOLCHAIN }}

RUN mkdir /unique_parachain
WORKDIR /unique_parachain


# ===== BUILD ======
FROM rust-builder as builder-unique

ARG PROFILE=release

COPY . /unique_parachain
WORKDIR /unique_parachain

RUN echo "Requested features: {{ NETWORK }}-runtime\n" && \
echo "Fork from: {{ REPLICA_FROM }}\n" && \
cargo build --features=try-runtime,{{ NETWORK }}-runtime --release

CMD cargo run --release --features {{ NETWORK }}-runtime,try-runtime -- try-runtime --runtime target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm -lruntime=debug -ltry-runtime::cli=debug on-runtime-upgrade --checks live --uri {{ REPLICA_FROM }}
2 changes: 1 addition & 1 deletion .docker/Dockerfile-xcm.j2
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ COPY --from=uniquenetwork/builder-moonbeam:{{ MOONBEAM_BUILD_BRANCH }} /unique_p
COPY --from=uniquenetwork/builder-cumulus:{{ CUMULUS_BUILD_BRANCH }} /unique_parachain/cumulus/target/release/polkadot-parachain /cumulus/target/release/cumulus
COPY --from=uniquenetwork/builder-acala:{{ ACALA_BUILD_BRANCH }} /unique_parachain/Acala/target/production/acala /acala/target/release/
COPY --from=uniquenetwork/builder-astar:{{ ASTAR_BUILD_BRANCH }} /unique_parachain/astar/target/release/astar /astar/target/release/
COPY --from=uniquenetwork/builder-chainql:latest /chainql/target/release/chainql /chainql/target/release/
COPY --from=uniquenetwork/builder-chainql:{{ CHAINQL }} /chainql/target/release/chainql /chainql/target/release/

EXPOSE 9844
EXPOSE 9933
Expand Down
12 changes: 12 additions & 0 deletions .docker/docker-compose.forkless-data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.5"

services:
forkless-data:
image: uniquenetwork/ci-forkless-data-local:{{ NETWORK }}-{{ BUILD_TAG }}
container_name: forkless-data
expose:
- 9944
- 9933
ports:
- 127.0.0.1:9944:9944
- 127.0.0.1:9933:9933
12 changes: 12 additions & 0 deletions .docker/docker-compose.forkless-nodata.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.5"

services:
forkless-nodata:
image: uniquenetwork/ci-forkless-nodata-local:{{ NETWORK }}-{{ BUILD_TAG }}
container_name: forkless-nodata
expose:
- 9944
- 9933
ports:
- 127.0.0.1:9944:9944
- 127.0.0.1:9933:9933
43 changes: 0 additions & 43 deletions .docker/docker-compose.tmp-forkless-data.j2

This file was deleted.

Loading

0 comments on commit 6221fea

Please sign in to comment.