FROM ubuntu:focal
WORKDIR /root
RUN apt-get update && \
    apt-get install -y git gcc make numactl python && \
    git clone https://github.com/KunZheng/mosbench.git
    # MOSBENCH seems disappeared in MIT's server. This git repo is a copy.
WORKDIR /root/mosbench/exim
# build client appliation
COPY smtpbm.c smtpbm.c
COPY run-smtpbm-by-ip run-smtpbm-by-ip
RUN make smtpbm
# change the run-smtpbm script in MOSBENCH so it could accept more options
# the old one can only send email to localhost and cann't set experiment duration.
# the new one can accept options: <client_count> <port> <server_ip> <duration>
RUN chmod +x run-smtpbm-by-ip
RUN echo '/root/mosbench/exim/run-smtpbm-by-ip $@' > /root/start.sh
