Skip to content

Latest commit

 

History

History
65 lines (47 loc) · 1.86 KB

README.md

File metadata and controls

65 lines (47 loc) · 1.86 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 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" \
    useink/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 useink/contracts-verifiable:0.0.1-local --build-arg CARGO_CONTRACT_VERSION=4.1.0 .

Run docker container:

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