84 lines
2.0 KiB
Docker
84 lines
2.0 KiB
Docker
ARG RUST_VERSION=1.76.0
|
|
|
|
FROM scratch AS base
|
|
ENV NETWORK=mainnet
|
|
ENV VERSION=1.17.3
|
|
# https://codeload.github.com/MystenLabs/sui/zip/refs/tags/mainnet-v1.17.3
|
|
ENV SRC_SITE=https://codeload.github.com/MystenLabs/sui/tar.gz/refs/tags
|
|
ENV SRC_HASH=0ca2c1480c33b24849ee1fb95f70999aed2c68450c4f6ffac253eefaa91a82ed
|
|
|
|
FROM base AS fetch
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE}/${NETWORK}-v${VERSION} sui.tar.gz
|
|
|
|
FROM stagex/rust:${RUST_VERSION} AS rust
|
|
FROM fetch AS rust-fetch
|
|
|
|
COPY --from=stagex/busybox . /
|
|
COPY --from=stagex/musl . /
|
|
COPY --from=rust . /
|
|
|
|
COPY --from=stagex/gcc . /
|
|
COPY --from=stagex/llvm . /
|
|
COPY --from=stagex/libunwind . /
|
|
COPY --from=stagex/openssl . /
|
|
COPY --from=stagex/zlib . /
|
|
|
|
# NOTE: Necessary for `cargo fetch`, but CA trust is not relied upon
|
|
COPY --from=stagex/ca-certificates . /
|
|
|
|
# HACK: gcc puts things in /usr/lib64
|
|
COPY --from=stagex/gcc /usr/lib64/* /usr/lib/
|
|
|
|
RUN --network=none <<EOF
|
|
set -eux
|
|
tar xf sui.tar.gz
|
|
mv sui-${NETWORK}-v${VERSION} sui
|
|
EOF
|
|
|
|
WORKDIR sui
|
|
|
|
RUN cargo fetch
|
|
|
|
FROM rust-fetch AS build
|
|
|
|
# Rust build deps
|
|
|
|
COPY --from=stagex/binutils . /
|
|
COPY --from=stagex/gcc . /
|
|
COPY --from=stagex/llvm . /
|
|
COPY --from=stagex/make . /
|
|
COPY --from=stagex/musl . /
|
|
|
|
# Sui build deps
|
|
|
|
COPY --from=stagex/clang . /
|
|
COPY --from=stagex/linux-headers . /
|
|
|
|
ENV RUST_BACKTRACE=1
|
|
ENV RUSTFLAGS='-C target-feature=-crt-static -C codegen-units=1'
|
|
ENV GIT_REVISION=d338ed98cbb7dd1e9de9340ae9486880dfcb389a
|
|
|
|
RUN --network=none cargo build --frozen --release --bin sui-node
|
|
|
|
FROM scratch AS install
|
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/busybox . /rootfs
|
|
COPY --from=stagex/libunwind . /rootfs
|
|
COPY --from=stagex/gcc . /rootfs
|
|
COPY --from=stagex/musl . /rootfs
|
|
|
|
# HACK: gcc puts things in /usr/lib64
|
|
COPY --from=stagex/gcc /usr/lib64/* /rootfs/usr/lib/
|
|
|
|
COPY --from=build sui/target/release/sui-node /rootfs/usr/bin/sui-node
|
|
RUN --network=none find /rootfs -exec touch -hcd "@0" "{}" +
|
|
|
|
FROM scratch AS package
|
|
|
|
COPY --from=install /rootfs /
|
|
|
|
ENTRYPOINT ["/usr/bin/sui-node"]
|
|
CMD ["--version"]
|