From 8c5e7121effd70d74eefb4e2aa1b800937544784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 9 Dec 2021 18:22:38 +0100 Subject: [PATCH] Combine apt statements in Dockerfile Quoting the Docker documentation [1]: > Always combine RUN apt-get update with apt-get install in the same RUN > statement. > (...) > Using apt-get update alone in a RUN statement causes caching issues > and subsequent apt-get install instructions fail. > (...) > Docker sees the initial and modified instructions as identical and > reuses the cache from previous steps. As a result the apt-get update > is not executed because the build uses the cached version. Because the > apt-get update is not run, your build can potentially get an outdated > version of the curl and nginx packages. > > Using RUN apt-get update && apt-get install -y ensures your Dockerfile > installs the latest package versions with no further coding or manual > intervention. [1] https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 009653a6c..d36a827b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,7 @@ FROM ruby:2.7.4-buster ENV DEBIAN_FRONTEND noninteractive # Install essential Linux packages -RUN apt-get update -qq -RUN apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached cmake pkg-config shared-mime-info +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached cmake pkg-config shared-mime-info # Install Chromium for E2E integration tests RUN apt-get update -qq && apt-get install -y chromium