From c8a1e8573a37fb6f4ec04e058d5fbbbd4efcb916 Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 12:49:00 +0100 Subject: [PATCH 1/6] reduced images size to 974MB by hinting the ubuntu package manager to only install packages that are directly required by the package list. --- src/DockerBase/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index 5007f41f9d..2552e4bfe6 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -6,5 +6,5 @@ MAINTAINER GitTools Maintainers # So we are going to install mono on ubuntu instead RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list -RUN apt-get update && apt-get install libcurl3 tzdata unzip curl git-all mono-complete -y && apt-get -yqq clean +RUN apt-get update && apt-get install -y --no-install-recommends libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean RUN cp /usr/share/zoneinfo/GMT /etc/localtime From 1bb1874ee2a2c531110aba41e57b8b11a2c7fd31 Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 12:51:57 +0100 Subject: [PATCH 2/6] reduced the image size (to 935MB) again by putting more efford in cleaning up ubuntu package manager clutter. --- src/DockerBase/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index 2552e4bfe6..354402c923 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -6,5 +6,5 @@ MAINTAINER GitTools Maintainers # So we are going to install mono on ubuntu instead RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list -RUN apt-get update && apt-get install -y --no-install-recommends libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean +RUN apt-get update && apt-get install -y --no-install-recommends libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /tmp/* RUN cp /usr/share/zoneinfo/GMT /etc/localtime From 7740d8fcb88e6d37f3a6bf8479d7e0cecc75af9a Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 12:53:25 +0100 Subject: [PATCH 3/6] moved apt-get options infront of the command to help readability and to match the apt-get command to it's man page --- src/DockerBase/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index 354402c923..0846253264 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -6,5 +6,5 @@ MAINTAINER GitTools Maintainers # So we are going to install mono on ubuntu instead RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list -RUN apt-get update && apt-get install -y --no-install-recommends libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /tmp/* +RUN apt-get update && apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /tmp/* RUN cp /usr/share/zoneinfo/GMT /etc/localtime From 278e0a72c763a3b81f6f336f813297a0072ad264 Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 12:55:30 +0100 Subject: [PATCH 4/6] changed the required image to match the ubuntu xenial one, following official mono install instructions on their webpage: http://www.mono-project.com/download/#download-lin --- src/DockerBase/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index 0846253264..d4645be4b3 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -5,6 +5,6 @@ MAINTAINER GitTools Maintainers # Wheezy doesn't support glibc 2.15 which libgit2sharp requires # So we are going to install mono on ubuntu instead RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list RUN apt-get update && apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /tmp/* RUN cp /usr/share/zoneinfo/GMT /etc/localtime From cd77e1ac8b073fbab6b7ef09c99bc475db21cdaf Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 13:33:44 +0100 Subject: [PATCH 5/6] Improved readability and reorderd the timezone to the top as this is most likely the least subject to change --- src/DockerBase/Dockerfile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index d4645be4b3..093e47f198 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -2,9 +2,16 @@ FROM ubuntu:16.04 MAINTAINER GitTools Maintainers -# Wheezy doesn't support glibc 2.15 which libgit2sharp requires -# So we are going to install mono on ubuntu instead -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list -RUN apt-get update && apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /tmp/* -RUN cp /usr/share/zoneinfo/GMT /etc/localtime +# moviong the timezone setting at the top, as this may be the most infrequent change in this file +RUN ln -sfn /usr/share/zoneinfo/GMT /etc/localtime + +# Following current install guide from +# http://www.mono-project.com/download/#download-lin on 2017-12-08 +# regarding to the repository sources +RUN echo "deb http://download.mono-project.com/repo/ubuntu xenial main" |\ + tee /etc/apt/sources.list.d/mono-official.list +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&\ + apt-get update &&\ + apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete &&\ + apt-get -yqq clean &&\ + rm -rf /var/lib/apt/lists/* /tmp/* From 81900ea2faa833de97f9d266b6a8ccce220cd1fe Mon Sep 17 00:00:00 2001 From: Neil Scholten Date: Fri, 8 Dec 2017 13:38:21 +0100 Subject: [PATCH 6/6] Added more inline code to Dockerfile to ease up what's been done for the ubuntu novice. --- src/DockerBase/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile index 093e47f198..39d3fcc5c8 100644 --- a/src/DockerBase/Dockerfile +++ b/src/DockerBase/Dockerfile @@ -10,6 +10,12 @@ RUN ln -sfn /usr/share/zoneinfo/GMT /etc/localtime # regarding to the repository sources RUN echo "deb http://download.mono-project.com/repo/ubuntu xenial main" |\ tee /etc/apt/sources.list.d/mono-official.list + +# This will do: +# * Accept the repository key +# * Get the current package inventory state +# * Install given packages only with required dependencies +# * Cleanup to reduce Docker image size RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&\ apt-get update &&\ apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete &&\