# The main purpose of this container is to generate DNS traffic.
FROM ubuntu:18.04
WORKDIR /
# Install essentials.
RUN apt-get update && apt-get install -y --no-install-recommends sudo curl ca-certificates gnupg apt-transport-https supervisor python3-pip python3-setuptools python3-wheel libbind-dev libkrb5-dev libssl-dev libcap-dev libxml2-dev libjson-c-dev libgeoip-dev libprotobuf-c-dev libfstrm-dev liblmdb-dev libssl-dev dnsutils build-essential autoconf autotools-dev automake libtool git cmake libldns-dev libgnutls28-dev
RUN git clone https://github.com/libuv/libuv.git
WORKDIR /libuv
RUN sh autogen.sh && ./configure && make && make install
# Install flamethrower.
WORKDIR /
RUN git clone https://github.com/DNS-OARC/flamethrower
WORKDIR /flamethrower
RUN mkdir build; cd build && cmake .. && make && make install
# Setup dns sim.
WORKDIR /dns
COPY tests/dns/requirements.txt /dns
RUN pip3 install -r /dns/requirements.txt
COPY tests/dns/index.html tests/dns/sim.py /dns/
# Start flask app.
CMD FLASK_ENV=development FLASK_APP=sim.py LC_ALL=C.UTF-8 LANG=C.UTF-8 flask run --host 0.0.0.0
