FROM ubuntu:22.04

USER root

RUN apt update && apt install -y \
    curl \
    build-essential \
    libssl-dev \
    pkg-config \
    libudev-dev \
    procps \
    gcc-riscv64-unknown-elf \
    gcc-riscv64-linux-gnu \
    binutils-riscv64-linux-gnu \
    && rm -rf /var/lib/apt/lists/*

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

WORKDIR /usr/src/kii/

COPY . ./

RUN chmod +x noxis-rs/temp-process

RUN rustup target add riscv64gc-unknown-linux-gnu && rustup target add x86_64-unknown-linux-gnu

RUN cargo unibuild

ENTRYPOINT ["cargo", "test"]
