Patchwork docker: try to follow the best practices for writing Dockerfiles

login
register
mail settings
Submitter via Mercurial-devel
Date Oct. 1, 2017, 4:51 p.m.
Message ID <b99e818a197220cf0f3a.1506876709@cuben>
Download mbox | patch
Permalink /patch/24366/
State Accepted
Headers show

Comments

via Mercurial-devel - Oct. 1, 2017, 4:51 p.m.
# HG changeset patch
# User muxator <a.mux@inwind.it>
# Date 1506812542 -7200
#      Sun Oct 01 01:02:22 2017 +0200
# Node ID b99e818a197220cf0f3a6d608bc3ddbdee6dcd18
# Parent  0133ca39c68875e1d50e6ed48913e33e1f8f15ac
docker: try to follow the best practices for writing Dockerfiles

Merged multiple RUN instructions and sorted the arguments alphabetically
Reference: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
Augie Fackler - Oct. 1, 2017, 10:22 p.m.
On Sun, Oct 01, 2017 at 06:51:49PM +0200, a.mux--- via Mercurial-devel wrote:
> # HG changeset patch
> # User muxator <a.mux@inwind.it>
> # Date 1506812542 -7200
> #      Sun Oct 01 01:02:22 2017 +0200
> # Node ID b99e818a197220cf0f3a6d608bc3ddbdee6dcd18
> # Parent  0133ca39c68875e1d50e6ed48913e33e1f8f15ac
> docker: try to follow the best practices for writing Dockerfiles

queued, thanks

Patch

diff --git a/contrib/docker/centos5 b/contrib/docker/centos5
--- a/contrib/docker/centos5
+++ b/contrib/docker/centos5
@@ -1,9 +1,23 @@ 
 FROM centos:centos5
-RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
-RUN sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo
-RUN sed -i 's/\$releasever/5.11/' /etc/yum.repos.d/*.repo
-RUN yum install -y gcc make rpm-build gettext tar
-RUN yum install -y python-devel python-docutils
+RUN \
+	sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo && \
+	sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo && \
+	sed -i 's/\$releasever/5.11/' /etc/yum.repos.d/*.repo
+
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python-devel \
+	python-docutils \
+	rpm-build \
+	tar
+
 # For creating repo meta data
-RUN yum install -y createrepo
-RUN yum install -y readline-devel openssl-devel ncurses-devel zlib-devel bzip2-devel
+RUN yum install -y \
+	bzip2-devel \
+	createrepo \
+	ncurses-devel \
+	openssl-devel \
+	readline-devel \
+	zlib-devel
diff --git a/contrib/docker/centos6 b/contrib/docker/centos6
--- a/contrib/docker/centos6
+++ b/contrib/docker/centos6
@@ -1,11 +1,20 @@ 
 FROM centos:centos6
-RUN yum install -y gcc
-RUN yum install -y python-devel python-docutils
-RUN yum install -y make
-RUN yum install -y rpm-build
-RUN yum install -y gettext
-RUN yum install -y tar
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python-devel \
+	python-docutils \
+	rpm-build \
+	tar
+
 # For creating repo meta data
 RUN yum install -y createrepo
+
 # For python
-RUN yum install -y readline-devel openssl-devel ncurses-devel zlib-devel bzip2-devel
+RUN yum install -y \
+	bzip2-devel \
+	ncurses-devel \
+	openssl-devel \
+	readline-devel \
+	zlib-devel
diff --git a/contrib/docker/centos7 b/contrib/docker/centos7
--- a/contrib/docker/centos7
+++ b/contrib/docker/centos7
@@ -1,9 +1,12 @@ 
 FROM centos:centos7
-RUN yum install -y gcc
-RUN yum install -y python-devel python-docutils
-RUN yum install -y make
-RUN yum install -y rpm-build
-RUN yum install -y gettext
-RUN yum install -y tar
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python-devel \
+	python-docutils \
+	rpm-build \
+	tar
+
 # For creating repo meta data
 RUN yum install -y createrepo
diff --git a/contrib/docker/debian.template b/contrib/docker/debian.template
--- a/contrib/docker/debian.template
+++ b/contrib/docker/debian.template
@@ -2,11 +2,11 @@ 
 RUN apt-get update && apt-get install -y \
   build-essential \
   debhelper \
+  devscripts \
   dh-python \
-  devscripts \
   less \
   python \
   python-all-dev \
   python-docutils \
-  zip \
-  unzip
+  unzip \
+  zip
diff --git a/contrib/docker/fedora20 b/contrib/docker/fedora20
--- a/contrib/docker/fedora20
+++ b/contrib/docker/fedora20
@@ -1,8 +1,11 @@ 
 FROM fedora:20
-RUN yum install -y gcc
-RUN yum install -y python-devel python-docutils
-RUN yum install -y make
-RUN yum install -y rpm-build
-RUN yum install -y gettext
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python-devel \
+	python-docutils \
+	rpm-build
+
 # For creating repo meta data
 RUN yum install -y createrepo
diff --git a/contrib/docker/fedora21 b/contrib/docker/fedora21
--- a/contrib/docker/fedora21
+++ b/contrib/docker/fedora21
@@ -1,8 +1,11 @@ 
 FROM fedora:21
-RUN yum install -y gcc
-RUN yum install -y python-devel python-docutils
-RUN yum install -y make
-RUN yum install -y rpm-build
-RUN yum install -y gettext
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python-devel \
+	python-docutils \
+	rpm-build
+
 # For creating repo meta data
 RUN yum install -y createrepo
diff --git a/contrib/docker/ubuntu.template b/contrib/docker/ubuntu.template
--- a/contrib/docker/ubuntu.template
+++ b/contrib/docker/ubuntu.template
@@ -2,11 +2,11 @@ 
 RUN apt-get update && apt-get install -y \
   build-essential \
   debhelper \
+  devscripts \
   dh-python \
-  devscripts \
   less \
   python \
   python-all-dev \
   python-docutils \
-  zip \
-  unzip
+  unzip \
+  zip