From ded6b5d565bc6d073ab38073f3b4ec6c03235c60 Mon Sep 17 00:00:00 2001 From: Philip Nagler-Frank Date: Tue, 19 Jan 2021 12:35:51 +0100 Subject: [PATCH] Align with Dockerfile best practices (#147) * minimize number of layers in Dockerfile * don't call apt-get upgrade in Dockerfile * remove apt cache after installing packages in Dockerfile * replace depreacted Maintainer field in Dockerfile * copy files after adding dependencies --- Dockerfile | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index a623fee..ea2650a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM ubuntu:20.04 -MAINTAINER Nicola Corna +LABEL maintainer="Nicola Corna " # Environment variables ####################### @@ -131,37 +131,29 @@ VOLUME $KEYS_DIR VOLUME $LOGS_DIR VOLUME $USERSCRIPTS_DIR -# Copy required files -##################### -COPY src/ /root/ - # Create missing directories ############################ -RUN mkdir -p $MIRROR_DIR -RUN mkdir -p $SRC_DIR -RUN mkdir -p $TMP_DIR -RUN mkdir -p $CCACHE_DIR -RUN mkdir -p $ZIP_DIR -RUN mkdir -p $LMANIFEST_DIR -RUN mkdir -p $KEYS_DIR -RUN mkdir -p $LOGS_DIR -RUN mkdir -p $USERSCRIPTS_DIR +RUN mkdir -p $MIRROR_DIR $SRC_DIR $TMP_DIR $CCACHE_DIR $ZIP_DIR $LMANIFEST_DIR \ + $KEYS_DIR $LOGS_DIR $USERSCRIPTS_DIR # Install build dependencies ############################ -RUN apt-get -qq update -RUN apt-get -qqy upgrade - -RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang \ +RUN apt-get -qq update && \ + apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang \ cron curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick \ kmod lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool \ libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps \ python rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm zip \ - zlib1g-dev + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* -RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo -RUN chmod a+x /usr/local/bin/repo +RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && \ + chmod a+x /usr/local/bin/repo + +# Copy required files +##################### +COPY src/ /root/ # Set the work directory ########################