-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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,42 @@ | ||
#!/bin/bash | ||
|
||
# Define URLs and file names | ||
TARBALL_URL="https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-aarch64-unknown-linux-musl.tar.gz" | ||
CHECKSUM_URL="https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-aarch64-apple-darwin.tar.gz.sha256" | ||
TARBALL_FILENAME="sccache.tar.gz" | ||
CHECKSUM_FILENAME="sccache.sha256" | ||
|
||
# Define the target directory where you want to extract the binary | ||
TARGET_DIR="/usr/local/cargo/bin" | ||
|
||
# Download the tarball and checksum | ||
echo "Downloading tarball..." | ||
wget "$TARBALL_URL" -O "$TARBALL_FILENAME" | ||
|
||
echo "Downloading checksum..." | ||
wget "$CHECKSUM_URL" -O "$CHECKSUM_FILENAME" | ||
|
||
# Verify the checksum | ||
echo "Verifying checksum..." | ||
EXPECTED_SHA256=$(cat "$CHECKSUM_FILENAME" | awk '{print $1}') | ||
ACTUAL_SHA256=$(sha256sum "$TARBALL_FILENAME" | awk '{print $1}') | ||
|
||
if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then | ||
echo "Checksum verification failed. Aborting." | ||
rm "$TARBALL_FILENAME" "$CHECKSUM_FILENAME" | ||
exit 1 | ||
fi | ||
|
||
# Extract the tarball | ||
echo "Extracting tarball..." | ||
tar -xzf "$TARBALL_FILENAME" | ||
|
||
# Copy the sccache binary to the target directory | ||
echo "Copying sccache binary to $TARGET_DIR" | ||
cp "sccache/sccache" "$TARGET_DIR/" | ||
|
||
# Clean up downloaded files and extracted folder | ||
rm "$TARBALL_FILENAME" "$CHECKSUM_FILENAME" | ||
rm -rf "sccache" | ||
|
||
echo "Installation completed successfully." |
This file contains 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# https://github.com/paritytech/polkadot-sdk/blob/master/docker/dockerfiles/polkadot/polkadot_injected_release.Dockerfile | ||
|
||
# ToDo: create a CI/builder image with preloaded tools | ||
FROM docker.io/library/ubuntu:22.04 as builder | ||
FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 as builder | ||
|
||
# Defaults | ||
ENV RUST_BACKTRACE 1 | ||
|
@@ -21,26 +21,32 @@ FROM docker.io/library/ubuntu:22.04 as builder | |
libclang-dev \ | ||
protobuf-compiler \ | ||
curl | ||
|
||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
ENV PATH="${PATH}:/root/.cargo/bin" | ||
|
||
|
||
ENV RUSTUP_HOME=/usr/local/rustup \ | ||
CARGO_HOME=/usr/local/cargo \ | ||
PATH=/usr/local/cargo/bin:$PATH | ||
# install rustup, use minimum components | ||
RUN curl -L "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \ | ||
-o rustup-init; \ | ||
chmod +x rustup-init; \ | ||
./rustup-init -y --no-modify-path --profile minimal --default-toolchain stable; \ | ||
rm rustup-init; | ||
# install sccache | ||
COPY ./ci/install-sccache-tarball.sh ./ | ||
RUN chmod +x install-sccache-tarball.sh && \ | ||
./install-sccache-tarball.sh | ||
|
||
# BUILD | ||
COPY . centrifuge-chain | ||
WORKDIR /centrifuge-chain | ||
RUN echo $(ls -l /centrifuge-chain/) | ||
RUN \ | ||
rustup-init -y --profile minimal --default-toolchain stable; \ | ||
cargo install sccache; | ||
|
||
RUN rustup default $RUST_TOOLCHAIN && \ | ||
rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN | ||
|
||
# RUN cargo build "--release" --features=${FEATURES} | ||
RUN cargo build "--release" --features=${FEATURES} | ||
|
||
# ===== SECOND STAGE ====== | ||
# ToDo: create a secure image as a base for the binary | ||
FROM docker.io/library/ubuntu:22.04 | ||
FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 | ||
|
||
LABEL io.centrifuge.image.authors="[email protected]" \ | ||
io.centrifuge.image.vendor="Centrifuge" \ | ||
|
@@ -67,13 +73,16 @@ FROM docker.io/library/ubuntu:22.04 | |
# RUN mv /usr/share/ca* /tmp && \ | ||
# rm -rf /usr/share/* && \ | ||
# mv /tmp/ca-certificates /usr/share/ | ||
|
||
# minimize the attack surface | ||
# rm -rf /usr/bin /usr/sbin /usr/lib/python* && \ | ||
# RUN rm -rf /usr/bin /usr/sbin /usr/lib/python* | ||
|
||
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* ; | ||
RUN mkdir -p /root/.local/share/centrifuge-chain && \ | ||
ln -s /root/.local/share/centrifuge-chain /data | ||
|
||
|
||
|
||
ENV RUST_BACKTRACE 1 | ||
USER centrifuge | ||
EXPOSE 30333 9933 9944 | ||
VOLUME ["/data"] | ||
|