Skip to content

Files

Latest commit

2c7d7ef · Feb 28, 2024

History

History
69 lines (49 loc) · 1.98 KB

README.md

File metadata and controls

69 lines (49 loc) · 1.98 KB

Verifiable builds using Docker

Docker image based on the minimalistic Debian image bitnami/minideb:bullseye-amd64.

Used for reproducible builds in cargo contract build --verifiable

Rust versions:

Currently, the 1.69 toolchain is temporarily required to build ink! contracts because of use-ink#1139

Rust tools & toolchains:

We use stable releases from crates.io

  • cargo-contract
  • wasm32-unknown-unknown: The toolchain to compile Rust codebases for Wasm.

Click here for the registry.

Usage

The default entry point is ENTRYPOINT [ "cargo", "contract", "build", "--release" ] and work directory is set to /contract. You need to mount the folder with the contract to the container.

docker run -d \
    --name ink-container \
    --mount type=bind,source="$(pwd)",target="/contract" \
    paritytech/contracts-verifiable

For multi-contract projects, like in the example below:

my-app/
├─ ink-project-a/
│  ├─ Cargo.toml
│  ├─ lib.rs
├─ ink-project-b/
│  ├─ Cargo.toml
│  ├─ lib.rs
├─ rust-toolchain

Make sure to run the command inside my-app directory and specify a relative manifest path to the root contract: cargo contract build --verifiable --release --manifest-path ink-project-a/Cargo.toml

Apple Silicon performance

It is a known issue that running AMD64 image on the ARM host architecture significantly impacts the performance and build times. To solve this issues, enable Use Rosetta for x86/amd64 emulation on Apple Silicon in Settings -> Features in development tab in Docker Desktop App.

How to debug

Build docker image:

docker buildx build -t paritytech/contracts-verifiable:0.0.1 .

Run docker container:

docker container run \
    -it --entrypoint /bin/bash \
    --mount type=bind,source="$(pwd)",target="/contract" \
    paritytech/contracts-verifiable:0.0.1