Simplify Dockerfile

Change-Id: I302dc1bf83115007919c9745912812fac8ac6648
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 0b1e910..f0114a4 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -20,7 +20,8 @@
 * Philipp Moll <https://github.com/phylib>
 * Eric Newberry <https://ericnewberry.com>
 * Varun Patil <https://github.com/pulsejet>
-* Md Ashiqur Rahman (Mini-NDN Docker support) <marahman@email.arizona.edu>
+* Davide Pesavento <https://github.com/Pesa>
+* Md Ashiqur Rahman <https://ashiqrahman.com>
 * Junxiao Shi <https://cs.arizona.edu/~shijunxiao>
 * Jeff Thompson <https://remap.ucla.edu/jeff-thompson>
 * Yucheng Zhang <https://peterskycloud.wixsite.com/yzportfolio>
diff --git a/Dockerfile b/Dockerfile
index 304da77..a48f26c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,37 +1,34 @@
-# Setup container with Ubuntu 22.04 image
+# syntax=docker/dockerfile:1
+
 FROM ubuntu:22.04
 
-# Set the working directory to /
-WORKDIR /
-
-# expose ports for openvswitch-switch
-EXPOSE 6633 6653 6640
-
-# Update container image
-RUN apt-get update -y && \
+# Install dependencies
+RUN <<EOF
+    set -eux
+    apt-get update -y
     apt-get install --no-install-recommends -y \
         lsb-release sudo \
         zip unzip wget git ca-certificates \
         curl iproute2 iputils-ping net-tools \
-        python3 python3-pip \
-        tcpdump vim x11-xserver-utils xterm && \
-        update-ca-certificates && \
-    rm -rf /var/lib/apt/lists/* && \
-    alias python=python3
+        python3 python3-pip python-is-python3 \
+        tcpdump vim x11-xserver-utils xterm
+    rm -rf /var/lib/apt/lists/*
+    update-ca-certificates
+EOF
 
 COPY . /mini-ndn
-
-RUN cd mini-ndn && \
-    pip3 install -r requirements.txt && \
-    ./install.sh -y --source && \
-    cd dl/mininet && make install && cd ../.. && \
-    cd dl/mininet-wifi && make install && cd ../.. && \
-    rm -rf dl && rm -rf /var/lib/apt/lists/* && cd /
-
-COPY docker/ENTRYPOINT.sh /
-RUN chmod +x ENTRYPOINT.sh
-
-# Change the working directory to /mini-ndn
 WORKDIR /mini-ndn
 
-ENTRYPOINT ["/ENTRYPOINT.sh"]
+RUN <<EOF
+    set -eux
+    pip3 install -r requirements.txt
+    ./install.sh -y --source
+    make -C dl/mininet install
+    make -C dl/mininet-wifi install
+    rm -rf dl /var/lib/apt/lists/*
+EOF
+
+# Expose ports for openvswitch-switch
+EXPOSE 6633 6653 6640
+
+ENTRYPOINT ["docker/entrypoint.sh"]
diff --git a/docker/ENTRYPOINT.sh b/docker/ENTRYPOINT.sh
deleted file mode 100644
index cd44fa7..0000000
--- a/docker/ENTRYPOINT.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-
-# set python3 alias, but needs permanent fix in image directly
-alias python=python3
-
-service openvswitch-switch start
-ovs-vsctl set-manager ptcp:6640
-
-bash
-
-service openvswitch-switch stop
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
new file mode 100755
index 0000000..45b7108
--- /dev/null
+++ b/docker/entrypoint.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+service openvswitch-switch start
+ovs-vsctl set-manager ptcp:6640
+
+bash
+
+service openvswitch-switch stop
diff --git a/docs/install.rst b/docs/install.rst
index 3f66750..3c4cd2a 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -19,9 +19,9 @@
 
 You can use the nightly build from GitHub package registry::
 
-    docker run -m 4g --cpus=4 -it --privileged \
-            -v /lib/modules:/lib/modules \
-            ghcr.io/named-data/mini-ndn:master bash
+    docker run -it --cpus=4 --memory=4g --privileged \
+        -v /lib/modules:/lib/modules \
+        ghcr.io/named-data/mini-ndn:master
 
 NOTE: This nightly build is only currently supported for x86_64. ARM64 support
 (i.e. Apple silicon Macs) will be added in the future.
@@ -30,33 +30,35 @@
 ------------------------------
 
 The provided Dockerfile can be used to build an image from scratch. To build with the Dockerfile:
+
   - Clone the repository and type::
 
         docker build -t minindn .
 
   - You can then access the container through shell with::
 
-        docker run -m 4g --cpus=4 -it --privileged \
+        docker run -it --cpus=4 --memory=4g --privileged \
             -v /lib/modules:/lib/modules \
-            minindn bin/bash
+            minindn
 
 Additional recommendations
 --------------------------
 
-- It is recommended to set reasonable constraints on memory (`-m`) and CPU cores (`--cpus`), especially on less
-  powerful or non-dedicated systems.
-- `--privileged` is mandatory for underlying `Mininet <https://mininet.org/>`__ to utilize the virtual switch
-- The root directory on `run` is `/mini-ndn`, which contains the installation and examples.
-- The GUI may not work for now due to docker and xterm setup issues and is independent from Mini-NDN.
-  If you intend to run the GUI, pass `-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix` to the `docker run` command.
+- It is recommended to set reasonable constraints on memory (``--memory``) and CPU cores (``--cpus``),
+  especially on less powerful or non-dedicated systems.
+- ``--privileged`` is mandatory for Mininet to utilize the virtual switch.
+- The container working directory is ``/mini-ndn``, which contains the installation and examples.
+- The GUI may not work due to docker and xterm setup issues and is independent from Mini-NDN. If you intend
+  to run the GUI, pass ``-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix`` to the ``docker run`` command.
 
 Using Vagrantfile
 -----------------
 
-With Vagrant installed, simply do ``vagrant up`` which will bring up an Ubuntu 18.04 virtual machine
+With Vagrant installed, simply do ``vagrant up`` which will bring up an Ubuntu 20.04 virtual machine
 and install Mini-NDN and all its dependencies on it. Please make sure to tweak the CPU core count
-(default 4 cores) and RAM (default 4GB) according to your needs before doing vagrant up. Mini-NDN
-can be found in /home/vagrant/mini-ndn which is a symlink to /vagrant if Vagrantfile was used from within mini-ndn cloned on the host. Otherwise it is an actual clone of mini-ndn.
+(default 4 cores) and RAM (default 4GB) according to your needs before doing ``vagrant up``. Mini-NDN
+can be found in ``/home/vagrant/mini-ndn`` which is a symlink to ``/vagrant`` if Vagrantfile was used
+from within mini-ndn cloned on the host. Otherwise it is an actual clone of mini-ndn.
 
 Using install.sh
 ----------------
@@ -81,7 +83,7 @@
 Some notable flags are:
 
 - ``-y`` skips interactive confirmation before installation.
-- ``--ppa`` prefers installing NDN software from `named-data PPA <https://launchpad.net/~named-data/+archive/ubuntu/ppa>`_.
+- ``--ppa`` prefers installing NDN software from the `named-data PPA <https://launchpad.net/~named-data/+archive/ubuntu/ppa>`__.
   This shortens installation time by downloading binary packages, but is only available on Ubuntu.
 - ``--source`` prefers installing NDN software from source code.
 - ``--use-existing`` will only install dependencies not already in the executable path.
@@ -167,7 +169,7 @@
 
 In cases where using NDN security is not important to the results, it is recommended
 to use the dummy keychain patch for ndn-cxx to disable it for improved scalability.
-This patch is located at `util/patches/ndn-cxx-dummy-keychain.patch.`
+This patch is located at ``util/patches/ndn-cxx-dummy-keychain.patch``.
 
 Note that all three of these can be installed from the Named Data PPA.
 Instructions for setting it up can be found in the NFD installation
@@ -175,10 +177,9 @@
 mixed. You must completely remove PPA installs from the system if switching
 to source and vice-versa.
 
-For PPA installs, if you are using a custom nfd.conf file in an experiment, you should
-place it in /usr/local/etc/ndn/ rather than /etc/ndn/. This is to avoid
-a bug from the default configuration file for the PPA, which is
-incompatible with Mini-NDN.
+For PPA installs, if you are using a custom ``nfd.conf`` file in an experiment, you should
+place it in ``/usr/local/etc/ndn/`` rather than ``/etc/ndn/``. This is to avoid a bug with
+the default configuration file for the PPA, which is incompatible with Mini-NDN.
 
 Infoedit
 ________
@@ -243,9 +244,9 @@
   and infoedit.
 
 Using gpsd (Experimental)
-----------------
+-------------------------
 
 The gpsd application included currently is based on in-progress work and
-is not treated as part of the main dependencies. To use it, install the
-`gpsd` and `nc` (netcat) from your package manager, if not already present,
+is not treated as part of the main dependencies. To use it, install ``gpsd``
+and ``nc`` (netcat) from your package manager, if not already present,
 to enable the functionality.
diff --git a/requirements.txt b/requirements.txt
index 6e2edbd..cac5460 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
+joblib
 python-igraph
 setuptools
 tqdm
-joblib