-
Notifications
You must be signed in to change notification settings - Fork 127
Standardised verifiable builds #1148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
b3eafd3
docker image + tokio
SkymanOne a11bb5b
docker client draft
SkymanOne ade7003
refactoring execute func
SkymanOne 26328c6
successful docker build
SkymanOne 773a2ff
persist flags in the main execution context
SkymanOne 763cc77
docker readme + respect host flags
SkymanOne 300b725
add build steps
SkymanOne 7dca32b
better image, custom image arg, container reuse
SkymanOne 55b72f1
fix readme example
SkymanOne f63a53e
Merge branch 'master' into gn/verifiable-build
SkymanOne 9955f25
fix docs
SkymanOne 5fe03fb
update README
SkymanOne 47d63d0
docs fixes
SkymanOne 6d3d7fd
clarification in the docs
SkymanOne 334ed7c
use locked for cargo install
SkymanOne 55ce730
concat install and cleanup commands
SkymanOne 54e0291
use arg instead of env in dockerfile
SkymanOne e28ddcb
add version labels
SkymanOne a51ea03
update comments
SkymanOne 80c9252
decompose the function
SkymanOne fd4773a
correct argument passing in dockerfile
SkymanOne b2eb769
refactoring
SkymanOne 23bd332
more fixes
SkymanOne 5bb5ca4
Merge branch 'master' into gn/verifiable-build
SkymanOne c706c83
using remote registry + bell & whistles (progress bars)
SkymanOne 4c69b28
changelog entry
SkymanOne 427f27b
fixes
SkymanOne 000d302
refactoring
SkymanOne a8db873
explicitly specify versions of apt packages
SkymanOne 8264529
refactoring
SkymanOne a86dcce
add module docs
SkymanOne 5722084
Merge branch 'master' into gn/verifiable-build
SkymanOne 2c419eb
refactoring
SkymanOne 085a744
doc fix and optionally use git in docker image
SkymanOne 913d2a9
Error handling for builds
SkymanOne 1d84b3c
use single var in docker and refactor docker module
SkymanOne d237d73
notes on apple silicon
SkymanOne d0e00dd
remove unused arg in dockerfile
SkymanOne 2f35698
use target path correctly
SkymanOne 3e157f4
handle building with relative paths + permissions
SkymanOne b78d91e
Merge branch 'master' into gn/verifiable-build
SkymanOne 9800402
more flags in docker image + fixes
SkymanOne e489c74
Merge branch 'master' into gn/verifiable-build
SkymanOne 2fd00cf
remove unused code
SkymanOne 02aa0af
add git info to docker metadata
SkymanOne fa95d79
use env to detect running OS
SkymanOne ea251da
detect host OS
SkymanOne 696a5d1
non-root docker user
SkymanOne acf89ad
mount contract to home dir in docker
SkymanOne 217ab6a
give permission to target to everyone
SkymanOne 707bfb1
fix typo
SkymanOne f620dcc
use current uid and gid for docker
SkymanOne 37ae55d
conditional compilation
SkymanOne dd6a89d
dont cache ci template and use musl in docker
SkymanOne 5ec303b
OS specific code blocks
SkymanOne 7209fa3
print error logs
SkymanOne 85aceb1
Merge branch 'master' into gn/verifiable-build
SkymanOne 6b8a028
remove the message
SkymanOne 00d82b4
calculate digest in separate func
SkymanOne 14d1236
filter our status msgs in error
SkymanOne b2faaff
update comments
SkymanOne 73b7166
Merge branch 'master' into gn/verifiable-build
SkymanOne 4700472
resolve other merge conflicts
SkymanOne 0c40092
display container name
SkymanOne 14ab832
Merge branch 'master' into gn/verifiable-build
SkymanOne 92a7867
properly trancate error output
SkymanOne 517b4bf
Merge branch 'master' into gn/verifiable-build
SkymanOne b6b66e9
apply Andrews suggestions
SkymanOne 590b5b8
proper build step logs
SkymanOne d515504
fix generation of ABI
SkymanOne 44958e3
hash the cmd, not entrypoint for digest
SkymanOne ad1ddc6
fix args parsing and add docs
SkymanOne 6e02958
clippy fix
SkymanOne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| target/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| FROM docker.io/bitnami/minideb:bullseye-amd64 as slimmed-rust | ||
|
|
||
| # metadata | ||
| LABEL io.parity.image.vendor="Parity Technologies" \ | ||
|
SkymanOne marked this conversation as resolved.
|
||
| io.parity.image.title="contracts-verifiable" \ | ||
| io.parity.image.documentation="https://github.com/paritytech/scripts/blob/master/\ | ||
| dockerfiles/ink-ci-linux/README.md" \ | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
| io.parity.image.description="Inherits from docker.io/bitnami/minideb:bullseye. \ | ||
| rust nightly, clippy, rustfmt, miri, rust-src, rustc-dev, grcov, rust-covfix, \ | ||
| llvm-tools-preview, cargo-contract, xargo, binaryen, parallel, codecov, ink, solang" \ | ||
| io.parity.image.documentation="https://github.com/paritytech/cargo-contract/blob/master/\ | ||
| build-image/README.md" | ||
|
|
||
| ENV RUSTUP_HOME=/usr/local/rustup \ | ||
| CARGO_HOME=/usr/local/cargo \ | ||
| PATH=/usr/local/cargo/bin:$PATH \ | ||
| # The 1.69 toolchain is temporarily required to build ink! contracts because of | ||
| # https://github.com/paritytech/cargo-contract/issues/1139 | ||
| RUST_VERSION=1.69 | ||
|
|
||
| # Minimal Rust dependencies. | ||
| RUN set -eux \ | ||
| && apt-get update && apt-get -y install wget \ | ||
| && url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \ | ||
| && wget "$url" \ | ||
| && chmod +x rustup-init \ | ||
| && ./rustup-init -y --no-modify-path --profile minimal --component rust-src rustfmt --default-toolchain $RUST_VERSION \ | ||
| && rm rustup-init \ | ||
| && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ | ||
| && rustup --version \ | ||
| && cargo --version \ | ||
| && rustc --version \ | ||
| && apt-get remove -y --auto-remove wget \ | ||
| && apt-get -y install gcc \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| FROM slimmed-rust as cc-builder | ||
|
|
||
| # This is important, see https://github.com/rust-lang/docker-rust/issues/85 | ||
| ENV RUSTFLAGS="-C target-feature=-crt-static" | ||
|
|
||
| RUN apt-get -y update && apt-get -y install gcc g++ | ||
| # Install cargo contract | ||
| RUN cargo install cargo-contract | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Cleanup after `cargo install` | ||
| RUN rm -rf ${CARGO_HOME}/"registry" ${CARGO_HOME}/"git" /root/.cache/sccache | ||
|
|
||
| # apt clean up | ||
| RUN apt-get remove -y gnupg && \ | ||
| apt-get autoremove -y && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| FROM slimmed-rust as ink-dev | ||
|
|
||
| COPY --from=cc-builder /usr/local/cargo/bin/cargo-contract /usr/local/bin/cargo-contract | ||
|
|
||
| WORKDIR /contract | ||
|
|
||
| # default entry point | ||
| ENTRYPOINT ["cargo", "contract", "build", "--release"] | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Verifiable builds using Docker | ||
|
|
||
| Docker image based on our base CI image `<base-ci-linux:latest>`. | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
|
|
||
| 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 https://github.com/paritytech/cargo-contract/issues/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](https://hub.docker.com/repository/docker/paritytech/contracts-verifiable) 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. | ||
|
|
||
| ```bash | ||
| docker run -d \ | ||
| --name ink-container \ | ||
| --mount type=bind,source="$(pwd)",target="/contract" \ | ||
| paritytech/contracts-verified | ||
|
SkymanOne marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| If you have multi-contract project: | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
| ``` | ||
| my-app/ | ||
| ├─ ink-project-a/ | ||
| │ ├─ Cargo.toml | ||
| │ ├─ lib.rs | ||
| ├─ ink-project-b/ | ||
| │ ├─ Cargo.toml | ||
| │ ├─ lib.rs | ||
| ├─ rust-toolchain | ||
| ``` | ||
| Make sure you mount `my-app` directory and then call | ||
|
SkymanOne marked this conversation as resolved.
Outdated
|
||
| `cargo contract build --verifiable --release --manifest-path ink-project-a/Cargo.toml` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.