FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as sui-node

# RUN apt-get update && apt-get -y install libclang-dev jq cmake curl npm --no-install-recommends
RUN dnf -y update
RUN dnf -y install jq cmake curl npm git gcc openssl-devel gcc-c++ clang make git

COPY sui/scripts/setup_rust.sh  /tmp
RUN /tmp/setup_rust.sh

WORKDIR /tmp

COPY sui/scripts/node_builder.sh  /tmp

RUN /tmp/node_builder.sh

WORKDIR /tmp

FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as export-stage

COPY --from=sui-node /root/.cargo/bin/sui /bin/sui
COPY --from=sui-node /root/.cargo/bin/sui-faucet /bin/sui-faucet
COPY --from=sui-node /root/.cargo/bin/sui-node /bin/sui-node
