git.delta.rocks / unique-network / refs/commits / 2e027a9a71a2

difftreelog

source

.docker/Dockerfile-unique2.7 KiBsourcehistory
1# ===== Rust builder =====2FROM ubuntu:22.04 as rust-builder3LABEL maintainer="Unique.Network"45ENV CARGO_HOME="/cargo-home"6ENV PATH="/cargo-home/bin:$PATH"7ENV TZ=UTC8RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone910RUN apt-get update && \11    apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \12    apt-get clean && \13    rm -r /var/lib/apt/lists/*1415RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none1617ARG RUST_TOOLCHAIN18RUN echo "Using Rust '$RUST_TOOLCHAIN'" && \19    rustup toolchain install $RUST_TOOLCHAIN && \20    rustup target add wasm32-unknown-unknown --toolchain ${RUST_TOOLCHAIN} && \21    rustup default $RUST_TOOLCHAIN && \22    rustup target list --installed && \23    rustup show2425RUN mkdir /unique_parachain26WORKDIR /unique_parachain2728# ===== BUILD UNIQUE =====29FROM rust-builder as builder-polkadot-bin3031WORKDIR /unique_parachain3233COPY . unique-chain/3435ARG RUNTIME_FEATURES36# registry for Updating registry. It is safe to cache it, because it only contains references to the dependency files,37#   and the caches for the files themselves are set in Cargo.lock, which won't be updated because of --locked flag38# git for Updating git repository. It is safe to cache it, because git dependencies are cached by revision,39#   revision is locked in Cargo.lock, and it is forbidden to update the Cargo.lock, because of --locked flag40#   passed to cargo build41# target for built dependencies. Technically, it may be unsafe to cache it, but there was no bugs in the caching logic42#   of it to this day (Ignoring incremental compilation, which is explicitly disabled by CARGO_INCREMENTAL=0). Only the43#   fully built crates will be cached depending on the crate source, version and feature set, which are locked by44#   Cargo.lock, which can't be updated because of the --locked flag.45RUN --mount=type=cache,target=/cargo-home/registry \46    --mount=type=cache,target=/cargo-home/git \47    --mount=type=cache,target=/unique_parachain/unique-chain/target \48    cd unique-chain && \49    echo "Using runtime features '$RUNTIME_FEATURES'" && \50    CARGO_INCREMENTAL=0 cargo build --profile integration-tests --features=fast-inflation,"$RUNTIME_FEATURES" --locked && \51    mv ./target/integration-tests/unique-collator /unique_parachain/unique-chain/ && \52    cd target/integration-tests/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;5354# ===== BIN ======5556FROM ubuntu:22.04 as builder-polkadot5758COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/unique-collator /bin/unique-collator59COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/wasm /wasm60ENTRYPOINT ["/bin/unique-collator"]