]> git.puffer.fish Git - mirror/frr.git/commitdiff
Dockerfile: Move to project root and combine RUNs
authorChristian Franke <chris@opensourcerouting.org>
Wed, 17 Oct 2018 16:27:35 +0000 (18:27 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Thu, 29 Nov 2018 15:51:27 +0000 (16:51 +0100)
According to https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
`apt-get update` should always be combined with `apt-get install` in
the same `RUN` statement, to avoid installation of outdated packages.

Also, combine some more `RUN`s together as to avoid fewer layers.

Finally, remove some comments which are superflous. Comments shouldn't
describe what is done, especially when it's obvious. They should
explain why something is done.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
tests/topotests/Dockerfile [new file with mode: 0644]
tests/topotests/docker/Dockerfile [deleted file]

diff --git a/tests/topotests/Dockerfile b/tests/topotests/Dockerfile
new file mode 100644 (file)
index 0000000..8cd98c4
--- /dev/null
@@ -0,0 +1,66 @@
+FROM ubuntu:18.04
+
+RUN export DEBIAN_FRONTEND=noninteractive \
+    && apt-get update \
+    && apt-get install -y \
+        autoconf \
+        binutils \
+        bison \
+        flex \
+        gdb \
+        inetutils-ping \
+        install-info \
+        iproute2 \
+        less \
+        libtool \
+        libjson-c-dev \
+        libpython-dev \
+        libreadline-dev \
+        libc-ares-dev \
+        man \
+        mininet \
+        pkg-config \
+        python-pip \
+        python-sphinx \
+        rsync \
+        tcpdump \
+        texinfo \
+        tmux \
+        valgrind \
+        vim \
+        x11-xserver-utils \
+        xterm \
+    && pip install \
+        exabgp==3.4.17 \
+        ipaddr \
+        pytest
+
+RUN groupadd -r -g 92 frr \
+    && groupadd -r -g 85 frrvty \
+    && useradd -c "FRRouting suite" \
+               -d /var/run/frr \
+               -g frr \
+               -G frrvty \
+               -r \
+               -s /sbin/nologin \
+               frr \
+    && useradd -d /var/run/exabgp/ \
+               -s /bin/false \
+               exabgp
+
+# Configure coredumps
+RUN echo "" >> /etc/security/limits.conf; \
+    echo "* soft core unlimited" >> /etc/security/limits.conf; \
+    echo "root soft core unlimited" >> /etc/security/limits.conf; \
+    echo "* hard core unlimited" >> /etc/security/limits.conf; \
+    echo "root hard core unlimited" >> /etc/security/limits.conf
+
+# Copy run scripts to facilitate users wanting to run the tests
+COPY docker/ /opt/topotests
+WORKDIR /root
+ENV PATH "$PATH:/opt/topotests"
+
+RUN echo "cat /opt/topotests/motd.txt" >> /root/.profile && \
+      echo "export PS1='(topotests) $PS1'" >> /root/.profile
+
+ENTRYPOINT [ "bash", "/opt/topotests/entrypoint.sh" ]
diff --git a/tests/topotests/docker/Dockerfile b/tests/topotests/docker/Dockerfile
deleted file mode 100644 (file)
index eff9623..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-FROM ubuntu:18.04
-
-# Update system repos
-RUN DEBIAN_FRONTEND=noninteractive apt update
-
-# Install FRR dependencies
-RUN DEBIAN_FRONTEND=noninteractive apt install -y \
-      autoconf binutils bison flex libtool libjson-c-dev \
-      libpython-dev libreadline-dev libc-ares-dev python-sphinx \
-      install-info pkg-config texinfo
-
-# Install useful tools for debugging
-RUN DEBIAN_FRONTEND=noninteractive apt install -y \
-      gdb inetutils-ping iproute2 valgrind
-
-# Install mininet dependencies
-RUN DEBIAN_FRONTEND=noninteractive apt install -y \
-      mininet python-pip && \
-      pip install ipaddr pytest exabgp==3.4.17
-
-# Install user utilities
-RUN DEBIAN_FRONTEND=noninteractive apt install -y \
-      x11-xserver-utils xterm tmux vim tcpdump less man rsync
-
-# Configure FRR users
-RUN groupadd -r -g 92 frr && \
-      groupadd -r -g 85 frrvty && \
-      useradd -c "FRRouting suite" -d /var/run/frr -g frr -G frrvty \
-        -r -s /sbin/nologin frr
-
-# Configure exabgp user.
-RUN useradd -d /var/run/exabgp/ -s /bin/false exabgp
-
-# Configure coredumps.
-RUN echo "" >> /etc/security/limits.conf; \
-    echo "* soft core unlimited" >> /etc/security/limits.conf; \
-    echo "root soft core unlimited" >> /etc/security/limits.conf; \
-    echo "* hard core unlimited" >> /etc/security/limits.conf; \
-    echo "root hard core unlimited" >> /etc/security/limits.conf
-
-# Copy run scripts to facilitate users wanting to run the tests
-COPY . /opt/topotests
-WORKDIR /root
-
-RUN echo "cat /opt/topotests/motd.txt" >> /root/.profile && \
-      echo "export PS1='(topotests) $PS1'" >> /root/.profile
-
-# Configure volumes
-VOLUME [ "/root/frr", "/root/topotests" ]
-
-# Add topotests script directory to path
-ENV PATH "$PATH:/opt/topotests"
-
-# Use our custom entrypoint script
-ENTRYPOINT [ "bash", "/opt/topotests/entrypoint.sh" ]