1
1
FROM docker.io/library/debian:stable-slim
2
2
3
3
# ## meta ###
4
- ENV RUST_STABLE_VERSION=1.85.0 \
4
+ ENV RUST_STABLE_VERSION=1.86.0 \
5
+ # restricted by https://github.com/trailofbits/dylint/blob/master/examples/general/rust-toolchain
5
6
RUST_NIGHTLY_VERSION=2025-02-20 \
6
- POLKADOT_SDK_HASH=c6249dca5928c12c35c577b971277d4211c928b7
7
+ POLKADOT_SDK_BRANCH=stable2503
7
8
8
9
WORKDIR /builds
9
10
@@ -14,6 +15,9 @@ ENV SHELL=/bin/bash \
14
15
PATH=/usr/local/cargo/bin:$PATH \
15
16
RUST_BACKTRACE=1
16
17
18
+ ARG TARGETARCH
19
+ ENV ARCH=$TARGETARCH
20
+
17
21
# ## base ###
18
22
19
23
# base | add non-root user
@@ -31,80 +35,89 @@ RUN set -eux; \
31
35
# needed for `paritytech/revive`
32
36
libtinfo-dev \
33
37
# needed for `cargo-spellcheck`
34
- libclang-dev
38
+ libclang-dev && \
39
+ # base | clean up layer
40
+ apt-get autoremove -y && \
41
+ apt-get clean && \
42
+ rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /usr/local/doc /usr/lib/llvm-11 /tmp/* /var/tmp/*
35
43
36
44
# ## generic ci ####
37
45
38
46
ARG GH_TOOL_VERSION="2.54.0"
39
47
40
- RUN wget "https://github.com/cli/cli/releases/download/v${GH_TOOL_VERSION}/gh_${GH_TOOL_VERSION}_linux_amd64.deb" && \
41
- dpkg -i "gh_${GH_TOOL_VERSION}_linux_amd64.deb" && rm "gh_${GH_TOOL_VERSION}_linux_amd64.deb"
48
+ RUN wget "https://github.com/cli/cli/releases/download/v${GH_TOOL_VERSION}/gh_${GH_TOOL_VERSION}_linux_${TARGETARCH}.deb" && \
49
+ dpkg -i "gh_${GH_TOOL_VERSION}_linux_${TARGETARCH}.deb" && \
50
+ rm "gh_${GH_TOOL_VERSION}_linux_${TARGETARCH}.deb"
42
51
43
- # generic ci | install stable rust
52
+ # generic ci | install rust toolchains
44
53
# llvm-tools-preview is for grcov
45
54
# base | install rustup, use minimum components
46
- RUN curl -L "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \
47
- -o rustup-init && \
55
+ RUN case ${TARGETARCH} in \
56
+ "amd64" ) RUST_ARCH="x86_64" ;; \
57
+ "arm64" ) RUST_ARCH="aarch64" ;; \
58
+ *) RUST_ARCH=${TARGETARCH} ;; \
59
+ esac && \
60
+ curl -L "https://static.rust-lang.org/rustup/dist/${RUST_ARCH}-unknown-linux-gnu/rustup-init" -o rustup-init && \
48
61
chmod u+x rustup-init && \
49
62
./rustup-init -y --no-modify-path --default-toolchain none && \
50
63
rm -f rustup-init && \
51
64
chown -R root:nonroot ${RUSTUP_HOME} ${CARGO_HOME} && \
52
65
chmod -R g+w ${RUSTUP_HOME} ${CARGO_HOME} && \
66
+ # generic ci | install specific stable version
53
67
rustup toolchain install "${RUST_STABLE_VERSION}" --profile minimal \
54
68
--component rustfmt,clippy,rust-src,llvm-tools-preview && \
55
69
rustup default "${RUST_STABLE_VERSION}" && \
56
70
rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git" && \
57
71
# generic ci | "alias" pinned stable toolchain as generic stable
58
- ln -s "/usr/local/rustup/toolchains/${RUST_STABLE_VERSION}-x86_64-unknown-linux-gnu" /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu && \
59
- # generic ci | install asm toolchain for the default stable toolchain
60
- rustup target add riscv64imac-unknown-none-elf && \
61
- # needed for `ink-node`
62
- rustup target add wasm32v1-none && \
63
- cargo install --git https://github.com/use-ink/ink-node --branch main --force --locked && \
72
+ ln -s "/usr/local/rustup/toolchains/${RUST_STABLE_VERSION}-${RUST_ARCH}-unknown-linux-gnu" "/usr/local/rustup/toolchains/stable-${RUST_ARCH}-unknown-linux-gnu" && \
73
+ # generic ci | install asm toolchain for the default stable toolchain; `wasm32v1-none` for `ink-node`
74
+ rustup target add riscv64imac-unknown-none-elf wasm32v1-none && \
64
75
# generic ci | install specific rust nightly, default is stable, use minimum components
65
76
rustup toolchain install "nightly-${RUST_NIGHTLY_VERSION}" --profile minimal \
66
- --component rustfmt,clippy,rust-analyzer,llvm-tools,rustc-dev,rust-src,llvm-tools-preview && \
67
- rustup toolchain install "nightly" --profile minimal \
68
- --component rustfmt,clippy,rust-analyzer,llvm-tools,rustc-dev,rust-src,llvm-tools-preview && \
69
- # generic ci | "alias" pinned nightly toolchain as generic nightly
70
- rustup target add riscv64imac-unknown-none-elf \
71
- --toolchain "nightly" && \
72
- rustup default nightly && \
73
- rustup target add riscv64imac-unknown-none-elf \
74
- --toolchain "nightly-${RUST_NIGHTLY_VERSION}" && \
75
- rustup run nightly-${RUST_NIGHTLY_VERSION} cargo install cargo-dylint dylint-link && \
76
- cargo install cargo-spellcheck --locked && \
77
- cargo install cargo-nextest --locked && \
77
+ --component rustfmt,clippy,rust-analyzer,rustc-dev,rust-src,llvm-tools-preview && \
78
+ # generic ci | "alias" pinned nightly toolchain as rolling nightly
79
+ ln -s "/usr/local/rustup/toolchains/nightly-${RUST_NIGHTLY_VERSION}-${RUST_ARCH}-unknown-linux-gnu" "/usr/local/rustup/toolchains/nightly-${RUST_ARCH}-unknown-linux-gnu" && \
80
+ # generic ci | install asm toolchain for the nightly toolchain
81
+ rustup target add riscv64imac-unknown-none-elf --toolchain "nightly" && \
82
+ # generic ci | clean up layer
83
+ rm -rf "${RUSTUP_HOME}/downloads" "${RUSTUP_HOME}/tmp"
84
+
85
+ # generic ci | install core packages
86
+ RUN cargo +nightly install cargo-dylint dylint-link && \
87
+ cargo install cargo-spellcheck cargo-nextest xargo --locked && \
78
88
cargo install zepter --locked --version 1.5.1 && \
79
- cargo install --git https://github.com/paritytech/cargo-contract \
80
- --locked --branch master && \
81
- git clone https://github.com/paritytech/polkadot-sdk.git -- depth 50 && \
89
+ cargo install --git https://github.com/use-ink/ink-node --branch main --force --locked && \
90
+ cargo install --git https://github.com/use-ink/cargo-contract --locked --branch master && \
91
+ git clone https://github.com/paritytech/polkadot-sdk.git -b ${POLKADOT_SDK_BRANCH} -- depth 1 && \
82
92
cd polkadot-sdk/ && \
83
- git reset --hard ${POLKADOT_SDK_HASH} && \
84
93
cargo +nightly install --path substrate/bin/utils/subkey --locked && \
85
94
cargo +nightly install --path substrate/frame/revive/rpc --locked && \
86
95
cd ../ && rm -rf polkadot-sdk/ && \
87
96
# We require `grcov` for coverage reporting and `rust-covfix` to improve it.
88
- cargo install grcov rust-covfix && \
89
- # codecov
90
- cargo +nightly install grcov rust-covfix xargo dylint-link && \
97
+ cargo +nightly install grcov rust-covfix --locked && \
91
98
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import && \
92
99
# Download the binary release of `paritytech/revive`
93
- curl -L https://github.com/paritytech/revive/releases/download/v0.1.0-dev.12/resolc-x86_64-unknown-linux-musl.tar.gz > resolc.tar.gz && \
94
- tar -xvzf resolc.tar.gz && \
95
- rm resolc.tar.gz && \
96
- chmod +x resolc-x86_64-unknown-linux-musl && \
97
- mv resolc-x86_64-unknown-linux-musl /usr/local/bin/resolc
100
+ if [ "$TARGETARCH" = "amd64" ]; then \
101
+ curl -fsSL -O https://github.com/paritytech/revive/releases/download/v0.1.0-dev.13/resolc-x86_64-unknown-linux-musl && \
102
+ chmod +x resolc-x86_64-unknown-linux-musl && \
103
+ mv resolc-x86_64-unknown-linux-musl /usr/local/bin/resolc; \
104
+ else \
105
+ echo "Skipping x86_64 specific installation of resolc for $TARGETARCH" ; \
106
+ fi && \
107
+ # generic ci | clean up layer
108
+ rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git"
98
109
99
110
# Install node.js 22.x. Used for testing revive with hardhat.
100
111
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
101
112
apt-get install -y nodejs && \
102
113
node -v && npm -v && npx -v && \
103
114
apt-get autoremove -y && \
104
- apt-get clean
115
+ apt-get clean && \
116
+ rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man
105
117
106
118
# codecov uploader
107
119
ARG CODECOV_UPLOADER_VERSION="v0.7.3"
120
+ ARG CODECOV_CLI_VERSION="v0.6.0"
108
121
109
122
RUN curl --remote-name --silent https://uploader.codecov.io/${CODECOV_UPLOADER_VERSION}/linux/codecov && \
110
123
curl --remote-name --silent https://uploader.codecov.io/${CODECOV_UPLOADER_VERSION}/linux/codecov.SHA256SUM && \
@@ -113,27 +126,13 @@ RUN curl --remote-name --silent https://uploader.codecov.io/${CODECOV_UPLOADER_V
113
126
shasum --algorithm 256 --check codecov.SHA256SUM && \
114
127
chmod +x codecov && \
115
128
mv codecov /usr/local/bin/codecov && \
116
- rm -f codecov.SHA256SUM codecov.SHA256SUM.sig
117
-
118
- # codecov-cli
119
- ARG CODECOV_CLI_VERSION="v0.6.0"
120
-
121
- RUN curl -Os https://cli.codecov.io/${CODECOV_CLI_VERSION}/linux/codecov && \
129
+ rm -f codecov.SHA256SUM codecov.SHA256SUM.sig && \
130
+ # codecov-cli
131
+ curl -Os https://cli.codecov.io/${CODECOV_CLI_VERSION}/linux/codecov && \
122
132
curl -Os https://cli.codecov.io/${CODECOV_CLI_VERSION}/linux/codecov.SHA256SUM && \
123
133
curl -Os https://cli.codecov.io/${CODECOV_CLI_VERSION}/linux/codecov.SHA256SUM.sig && \
124
134
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM && \
125
135
shasum -a 256 -c codecov.SHA256SUM && \
126
136
chmod +x codecov && \
127
137
mv codecov /usr/local/bin/codecovcli && \
128
138
rm -f codecov.SHA256SUM codecov.SHA256SUM.sig
129
-
130
- # ## finalize ###
131
-
132
- # finalize | apt clean up
133
- RUN rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git" && \
134
- apt-get autoremove -y && \
135
- apt-get clean && \
136
- rm -rf /var/lib/apt/lists/* \
137
- rm -rf /usr/local/doc \
138
- rm -rf /usr/lib/llvm-11 \
139
- rm -rf /tmp/*
0 commit comments