FROM rust:1.62@sha256:5777f201f507075309c4d2d1c1e8d8219e654ae1de154c844341050016a64a0c as sui-node

WORKDIR /tmp

RUN curl -L https://github.com/MystenLabs/sui/releases/download/mainnet-v1.19.1/sui-mainnet-v1.19.1-ubuntu-x86_64.tgz > sui-mainnet-v1.19.1-ubuntu-x86_64.tgz
RUN echo "6a8cc96759760293143a00fe7031a5fea70d2dff5b98d18c0470c09555da63e0  sui-mainnet-v1.19.1-ubuntu-x86_64.tgz" | sha256sum -c --status

RUN tar -xvf sui-mainnet-v1.19.1-ubuntu-x86_64.tgz
RUN mv target/release/sui-ubuntu-x86_64 /bin/sui
RUN mv target/release/sui-faucet-ubuntu-x86_64 /bin/sui-faucet
RUN mv target/release/sui-node-ubuntu-x86_64 /bin/sui-node

RUN rm sui-mainnet-v1.19.1-ubuntu-x86_64.tgz

RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

ARG NODE_MAJOR=18
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

RUN apt-get update
RUN apt-get install nodejs -y
