Skip to content

build: optimize dockerfile #4

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 3 commits into from
Apr 24, 2025
Merged

build: optimize dockerfile #4

merged 3 commits into from
Apr 24, 2025

Conversation

evilrobot-01
Copy link
Contributor

@evilrobot-01 evilrobot-01 commented Apr 21, 2025

Updates the ci Dockerfile to:

  • use the latest stable version of Rust (1.86)
  • standardise on a single version of nightly
  • use stable2503 release branch of the Polkadot SDK
  • allow (mostly) building on ARM platforms
  • split rustup and cargo install into separate layers for easier disk usage analysis
  • perform cleanup on each layer
  • use updated url for cargo-contract
  • merge the codecov tasks into a single layer
  • switches to using stable as the default toolchain

Note:

Comments have been left as a guide.

rm resolc.tar.gz && \
chmod +x resolc-x86_64-unknown-linux-musl && \
mv resolc-x86_64-unknown-linux-musl /usr/local/bin/resolc
if [ "$TARGETARCH" = "amd64" ]; then \
Copy link
Contributor Author

@evilrobot-01 evilrobot-01 Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally revive should provide an arm64 binary for usage within Docker on apple silicon. Simply ignored on non-amd64 platforms for now, which should only affect ink integration tests when built on a Mac AFAIK.

An issue can be opened on revive to add Linux arm64 builds so that it can be used within containers on a Mac.

Updates the `ci` Dockerfile to:
- use the latest stable version of Rust (1.86)
- standardise on a single version of nightly
- use stable2503 release branch of the Polkadot SDK
- allow (mostly) building on ARM platforms
- split rustup and cargo install into separate layers for easier disk usage analysis
- perform cleanup on each layer
- use updated url for cargo-contract
- merge the codecov tasks into a single layer
@evilrobot-01 evilrobot-01 force-pushed the frank/optimise-image branch from a4b2a16 to 7e33256 Compare April 23, 2025 09:46
git clone https://github.com/paritytech/polkadot-sdk.git --depth 50 && \
cargo install --git https://github.com/use-ink/ink-node --branch main --force --locked && \
cargo install --git https://github.com/use-ink/cargo-contract --locked --branch master && \
git clone https://github.com/paritytech/polkadot-sdk.git -b ${POLKADOT_SDK_BRANCH} --depth 1 && \
Copy link
Contributor Author

@evilrobot-01 evilrobot-01 Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A faster approach is to download from a GitHub source code archive at a specific commit and decompress. As these images are generated rarely, not sure its worth the effort.

cargo install --git https://github.com/paritytech/cargo-contract \
--locked --branch master && \
git clone https://github.com/paritytech/polkadot-sdk.git --depth 50 && \
cargo install --git https://github.com/use-ink/ink-node --branch main --force --locked && \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be replaced with 'latest' prebuilt ink-node and cargo-contract binaries to speed things up.

@evilrobot-01 evilrobot-01 marked this pull request as ready for review April 23, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants