[Dockerfiles] Used best practices for apt-get

See https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#apt-get

- Replaced `-y install` with `install -y` (unification)

- Put every package on its own line

- Moved `rm -rf /var/lib/apt/lists/*` in the same `RUN` statement as `apt-get`

- Removed unnecessary `apt-get clean`
  See 03e2923e42/contrib/mkimage/debootstrap (L82-L105)
This commit is contained in:
Michael Käufl
2017-05-13 15:52:16 +02:00
parent d0d0961006
commit 9ab9d76240
7 changed files with 40 additions and 28 deletions

View File

@@ -5,8 +5,9 @@ ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C
ENV GOSU_VERSION 1.9
RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-transport-https gnupg \
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
gnupg \
ca-certificates \
wget \
syslog-ng \
@@ -14,6 +15,7 @@ RUN apt-get update \
supervisor \
mysql-client \
cron \
&& rm -rf /var/lib/apt/lists/* \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
@@ -29,8 +31,10 @@ RUN touch /usr/share/doc/sogo/empty.sh
RUN apt-key adv --keyserver keys.gnupg.net --recv-key 0x810273C4 \
&& echo "deb http://packages.inverse.ca/SOGo/nightly/3/debian/ jessie jessie" > /etc/apt/sources.list.d/sogo.list \
&& apt-get update \
&& apt-get -y --force-yes install sogo sogo-activesync
&& apt-get update && apt-get install -y --force-yes \
sogo \
sogo-activesync \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf
RUN echo '* * * * * sogo /usr/sbin/sogo-ealarms-notify' > /etc/cron.d/sogo
@@ -42,4 +46,4 @@ COPY supervisord.conf /etc/supervisor/supervisord.conf
CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN rm -rf /tmp/* /var/tmp/*