Skip to content

build: optimize dockerfile#4

Merged
evilrobot-01 merged 3 commits intomainfrom
frank/optimise-image
Apr 24, 2025
Merged

build: optimize dockerfile#4
evilrobot-01 merged 3 commits intomainfrom
frank/optimise-image

Conversation

@evilrobot-01
Copy link
Copy Markdown
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.

Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile Outdated
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
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
Copy Markdown
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.

Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Frank Bell added 2 commits April 23, 2025 10:43
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
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
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
Copy Markdown
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.

Comment thread ci/Dockerfile
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
Copy Markdown
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.

Comment thread ci/Dockerfile
Comment thread ci/Dockerfile
@evilrobot-01 evilrobot-01 marked this pull request as ready for review April 23, 2025 10:05
Comment thread ci/Dockerfile Outdated
Co-authored-by: David Semakula <davidsemakula@users.noreply.github.com>
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