Patchwork docker: try to be more adherent to the best practices for writing Dockerfiles

login
register
mail settings
Submitter via Mercurial-devel
Date Oct. 1, 2017, 4:26 p.m.
Message ID <75d89e4aec93490431b8.1506875186@cuben>
Download mbox | patch
Permalink /patch/24358/
State Superseded
Headers show

Comments

via Mercurial-devel - Oct. 1, 2017, 4:26 p.m.
# HG changeset patch
# User muxator <a.mux@inwind.it>
# Date 1506812542 -7200
#      Sun Oct 01 01:02:22 2017 +0200
# Node ID 75d89e4aec93490431b81526c292766f4c08b38e
# Parent  0133ca39c68875e1d50e6ed48913e33e1f8f15ac
docker: try to be more adherent to 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/
via Mercurial-devel - Oct. 1, 2017, 4:39 p.m.
Please ignore this patch.

I have just seen that the Fedora Dockerfiles need the same treatment.
I will send a single changeset.

Sorry for the noise.


On 10/01/2017 06:26 PM, a.mux@inwind.it wrote:
> # HG changeset patch
> # User muxator <a.mux@inwind.it>
> # Date 1506812542 -7200
> #      Sun Oct 01 01:02:22 2017 +0200
> # Node ID 75d89e4aec93490431b81526c292766f4c08b38e
> # Parent  0133ca39c68875e1d50e6ed48913e33e1f8f15ac
> docker: try to be more adherent to 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/
>
> 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
via Mercurial-devel - Oct. 1, 2017, 4:45 p.m.
Please ignore also this patch.

I have just seen that the Fedora Dockerfiles require the same treatment.
I will send a single changeset.



On 10/01/2017 06:26 PM, a.mux@inwind.it wrote:
> # HG changeset patch
> # User muxator <a.mux@inwind.it>
> # Date 1506812542 -7200
> #      Sun Oct 01 01:02:22 2017 +0200
> # Node ID 75d89e4aec93490431b81526c292766f4c08b38e
> # Parent  0133ca39c68875e1d50e6ed48913e33e1f8f15ac
> docker: try to be more adherent to 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/
>
> 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

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