Skip to content

Commit d7371c3

Browse files
committed
optimization debian package manager tweaks
By default, Ubuntu or Debian based "apt" or "apt-get" system installs recommended but not suggested packages . By passing "--no-install-recommends" option, the user lets apt-get know not to consider recommended packages as a dependency to install. This results in smaller downloads and installation of packages . Refer to blog at [Ubuntu Blog](https://ubuntu.com/blog/we-reduced-our-docker-images-by-60-with-no-install-recommends) . Also , added packages apt-utils ca-certificates Because build is 1. Slow because "apt-utils" not installed 2. to avoid build to exits with error without having certificate in wget , curl or even git clone Signed-off-by: Pratik Raj <[email protected]>
1 parent bcaa665 commit d7371c3

File tree

21 files changed

+79
-37
lines changed

21 files changed

+79
-37
lines changed

3.1/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ LABEL Description="Docker Container for the Apple's Swift programming language"
44

55
# Install related packages and set LLVM 3.8 as the compiler
66
RUN apt-get -q update && \
7-
apt-get -q install -y \
7+
apt-get --no-install-recommends install -y \
8+
apt-utils \
9+
ca-certificates \
810
make \
911
libc6-dev \
1012
clang-3.8 \

4.0/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ LABEL Description="Docker Container for the Apple's Swift programming language"
44

55
# Install related packages and set LLVM 3.8 as the compiler
66
RUN apt-get -q update && \
7-
apt-get -q install -y \
7+
apt-get --no-install-recommends install -y \
8+
apt-utils \
9+
ca-certificates \
810
make \
911
libc6-dev \
1012
clang-3.8 \

4.1/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ LABEL Description="Docker Container for the Apple's Swift programming language"
44

55
# Install related packages and set LLVM 3.8 as the compiler
66
RUN apt-get -q update && \
7-
apt-get -q install -y \
7+
apt-get --no-install-recommends install -y \
8+
apt-utils \
9+
ca-certificates \
810
make \
911
libc6-dev \
1012
clang-3.8 \

4.2/ubuntu/16.04/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ LABEL Description="Docker Container for the Swift programming language"
44

55
# Install related packages and set LLVM 3.8 as the compiler
66
RUN apt-get -q update && \
7-
apt-get -q install -y \
7+
apt-get --no-install-recommends install -y \
8+
apt-utils \
9+
ca-certificates \
810
make \
911
libc6-dev \
1012
clang-3.8 \

4.2/ubuntu/18.04/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ LABEL Description="Docker Container for the Swift programming language"
44

55
# Install related packages and set LLVM 3.9 as the compiler
66
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
7-
apt-get -q install -y \
7+
apt-get --no-install-recommends install -y \
8+
apt-utils \
9+
ca-certificates \
810
make \
911
libc6-dev \
1012
clang-3.9 \

5.0/ubuntu/16.04/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LABEL maintainer="Swift Infrastructure <[email protected]>"
33
LABEL Description="Docker Container for the Swift programming language"
44

55
RUN apt-get -q update && \
6-
apt-get -q install -y \
6+
apt-get --no-install-recommends install -y \
7+
apt-utils \
8+
ca-certificates \
79
libatomic1 \
810
libbsd0 \
911
libcurl3 \
@@ -33,7 +35,7 @@ ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
3335
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs
3436
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
3537
&& apt-get -q update \
36-
&& apt-get -q install -y curl \
38+
&& apt-get --no-install-recommends -q install -y curl \
3739
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
3840
&& curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
3941
&& apt-get purge -y curl \

5.0/ubuntu/16.04/slim/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LABEL maintainer="Swift Infrastructure <[email protected]>"
33
LABEL Description="Docker Container for the Swift programming language"
44

55
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
6-
apt-get -q install -y \
6+
apt-get --no-install-recommends install -y \
7+
apt-utils \
8+
ca-certificates \
79
libatomic1 \
810
libbsd0 \
911
libcurl3 \
@@ -23,7 +25,7 @@ ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
2325
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs
2426
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
2527
&& apt-get update \
26-
&& apt-get install -y curl \
28+
&& apt-get --no-install-recommends install -y curl \
2729
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
2830
&& curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
2931
&& export GNUPGHOME="$(mktemp -d)" \

5.0/ubuntu/18.04/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LABEL maintainer="Swift Infrastructure <[email protected]>"
33
LABEL Description="Docker Container for the Swift programming language"
44

55
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
6-
apt-get -q install -y \
6+
apt-get --no-install-recommends install -y \
7+
apt-utils \
8+
ca-certificates \
79
libatomic1 \
810
libbsd0 \
911
libcurl4 \
@@ -33,7 +35,7 @@ ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
3335
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs
3436
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
3537
&& apt-get update \
36-
&& apt-get install -y curl \
38+
&& apt-get --no-install-recommends install -y curl \
3739
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
3840
&& curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
3941
&& apt-get purge -y curl \

5.0/ubuntu/18.04/slim/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LABEL maintainer="Swift Infrastructure <[email protected]>"
33
LABEL Description="Docker Container for the Swift programming language"
44

55
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
6-
apt-get -q install -y \
6+
apt-get --no-install-recommends install -y \
7+
apt-utils \
8+
ca-certificates \
79
libatomic1 \
810
libbsd0 \
911
libcurl4 \
@@ -23,7 +25,7 @@ ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
2325
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs
2426
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
2527
&& apt-get update \
26-
&& apt-get install -y curl gpg \
28+
&& apt-get --no-install-recommends install -y curl gpg \
2729
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
2830
&& curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
2931
&& export GNUPGHOME="$(mktemp -d)" \

5.1/ubuntu/16.04/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LABEL maintainer="Swift Infrastructure <[email protected]>"
33
LABEL Description="Docker Container for the Swift programming language"
44

55
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
6-
apt-get -q install -y \
6+
apt-get --no-install-recommends install -y \
7+
apt-utils \
8+
ca-certificates \
79
libatomic1 \
810
libcurl3 \
911
libxml2 \
@@ -43,7 +45,7 @@ RUN set -e; \
4345
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
4446
# - Grab curl here so we cache better up above
4547
&& export DEBIAN_FRONTEND=noninteractive \
46-
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
48+
&& apt-get -q update && apt-get --no-install-recommends -q install -y curl && rm -rf /var/lib/apt/lists/* \
4749
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
4850
&& export GNUPGHOME="$(mktemp -d)" \
4951
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \

0 commit comments

Comments
 (0)