From a18e72d02268c3d0124eaebfbd2a468560ba9a29 Mon Sep 17 00:00:00 2001
From: Miguel Prada <miguel.prada@tecnalia.com>
Date: Fri, 17 May 2019 12:34:07 +0200
Subject: [PATCH] Relax Docker test severity and fix remaining issues

---
 .gitlab-ci.yml         | 11 +++++++++--
 deploy/base/Dockerfile |  2 +-
 deploy/dev/Dockerfile  | 11 +++++++----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 42cbb59..b933b39 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,12 +3,19 @@ shellcheck:
   script: 'shellcheck deploy/base/ros_entrypoint.bash scripts/*sh'
   allow_failure: yes
 
+# The ignored rules in hadolint checks are
+# DL3006 Always tag the version of an image explicitly
+#   One of the Dockerfiles uses a temporary image which isn't important to tag
+#   and the other uses a tagged image through an ARG, which apparently is not
+#   properly recognized.
+# DL3008 Pin versions in apt-get install
+#   A bit overkill
 dockerfiles:
   image: hadolint/hadolint:latest-debian
   script:
     - RET=0
-    - hadolint deploy/base/Dockerfile || RET=1
-    - hadolint deploy/dev/Dockerfile || RET=1
+    - hadolint --ignore DL3006 --ignore DL3008 deploy/base/Dockerfile || RET=1
+    - hadolint --ignore DL3006 --ignore DL3008 deploy/dev/Dockerfile || RET=1
     - exit $RET
   allow_failure: yes
 
diff --git a/deploy/base/Dockerfile b/deploy/base/Dockerfile
index 0b06faf..b5cd8cb 100644
--- a/deploy/base/Dockerfile
+++ b/deploy/base/Dockerfile
@@ -2,7 +2,7 @@ FROM industrial_ci_image
 
 RUN rm -rf /root/ici /root/src
 
-RUN apt-get update -qq && apt-get install -y -qq \
+RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
   ros-kinetic-rosbash \
   && rm -rf /var/lib/apt/lists/*
 
diff --git a/deploy/dev/Dockerfile b/deploy/dev/Dockerfile
index 9da3d06..75494d7 100644
--- a/deploy/dev/Dockerfile
+++ b/deploy/dev/Dockerfile
@@ -1,17 +1,20 @@
 ARG APPLICATION_IMAGE
 FROM ${APPLICATION_IMAGE}
 
-RUN apt-get update -qq && apt-get install -y -qq \
+RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
   apt-transport-https \
   curl \
-  libasound2
+  libasound2 \
+  && rm -rf /var/lib/apt/lists/*
 
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
 RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
   && mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
   && sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
 
-RUN apt-get update -qq && apt-get install -y -qq \
-  code
+RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
+  code \
+  && rm -rf /var/lib/apt/lists/*
 
 RUN echo "alias code='code --user-data-dir /root'" >> /root/.bashrc
 
-- 
GitLab