FROM rockylinux:9
RUN dnf -y install gcc gcc-c++ make cmake perl curl-minimal git tar gzip pkgconf-pkg-config \
    && dnf clean all
ENV CARGO_HOME=/opt/cargo RUSTUP_HOME=/opt/rustup
ENV PATH=/opt/cargo/bin:$PATH
COPY rust-toolchain.toml /tmp/rust-toolchain.toml
RUN curl --fail --silent --show-error https://sh.rustup.rs -o /tmp/rustup-init.sh \
    && sh /tmp/rustup-init.sh -y --profile minimal --default-toolchain none \
    && cd /tmp && rustup show active-toolchain \
    && rm /tmp/rustup-init.sh
WORKDIR /workspace
ENV CARGO_TARGET_DIR=/workspace/target/release-linux
CMD ["bash", "packaging/linux/build.sh"]
