git.delta.rocks / unique-network / refs/commits / e358d8144394

difftreelog

source

.docker/Dockerfile-unique2.4 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 none1617RUN mkdir /unique_parachain18WORKDIR /unique_parachain1920# ===== BUILD UNIQUE =====21FROM rust-builder as builder-polkadot-bin2223WORKDIR /unique_parachain2425COPY . unique-chain/2627ARG FEATURES28# registry for Updating registry. It is safe to cache it, because it only contains references to the dependency files,29#   and the caches for the files themselves are set in Cargo.lock, which won't be updated because of --locked flag30# git for Updating git repository. It is safe to cache it, because git dependencies are cached by revision,31#   revision is locked in Cargo.lock, and it is forbidden to update the Cargo.lock, because of --locked flag32#   passed to cargo build33# target for built dependencies. Technically, it may be unsafe to cache it, but there was no bugs in the caching logic34#   of it to this day (Ignoring incremental compilation, which is explicitly disabled by CARGO_INCREMENTAL=0). Only the35#   fully built crates will be cached depending on the crate source, version and feature set, which are locked by36#   Cargo.lock, which can't be updated because of the --locked flag.37RUN --mount=type=cache,target=/cargo-home/registry \38    --mount=type=cache,target=/cargo-home/git \39    --mount=type=cache,target=/unique_parachain/unique-chain/target \40    cd unique-chain && \41    echo "Using runtime features ${FEATURES}" && \42    CARGO_INCREMENTAL=0 cargo build --profile integration-tests --features=fast-inflation,"${FEATURES}" --locked && \43    mv ./target/integration-tests/unique-collator /unique_parachain/unique-chain/ && \44    cd target/integration-tests/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;4546# ===== BIN ======4748FROM ubuntu:22.04 as builder-polkadot4950COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/unique-collator /bin/unique-collator51COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/wasm /wasm52ENTRYPOINT ["/bin/unique-collator"]