ARG REGISTRY=
ARG TAG=:latest
FROM ${REGISTRY}simbricks/simbricks-build${TAG}
COPY --chown=simbricks . /simbricks
WORKDIR /simbricks
USER simbricks
RUN make -j `nproc` ENABLE_VERILATOR=y
RUN git submodule update --init sims/external/qemu \
 && make -j `nproc` sims/external/qemu/ready \
 && bash docker/cleanup_external.sh
RUN git submodule update --init sims/external/gem5 \
 && make -j `nproc` sims/external/gem5/ready \
 && bash docker/cleanup_gem5.sh
RUN git submodule update --init sims/external/femu \
 && make -j `nproc` sims/external/femu/ready
RUN git submodule update --init sims/external/ns-3 \
 && make -j `nproc` sims/external/ns-3/ready \
 && bash docker/cleanup_ns3.sh
ENV PYTHONPATH=/simbricks/experiments
RUN sudo cp docker/simbricks-run /usr/bin/ \
 && sudo chmod 755 /usr/bin/simbricks-run \
 && sudo ln -s /simbricks/sims/external/qemu/build/qemu-system-x86_64 \
    /usr/bin/qemu-system-x86_64 \
 && sudo ln -s /simbricks/sims/external/qemu/build/qemu-system-x86_64 \
    /usr/bin/kvm \
 && sudo ln -s /simbricks/sims/external/qemu/build/qemu-img \
    /usr/bin/qemu-img
