1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #39635 from thaJeztah/no_install_recommends

Dockerfile: use --no-install-recommends for all stages
This commit is contained in:
Kirill Kolyshkin 2019-08-05 15:46:10 -07:00 committed by GitHub
commit 86dad145e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ FROM base AS criu
# Install CRIU for checkpoint/restore support # Install CRIU for checkpoint/restore support
ENV CRIU_VERSION 3.11 ENV CRIU_VERSION 3.11
# Install dependency packages specific to criu # Install dependency packages specific to criu
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y --no-install-recommends \
libnet-dev \ libnet-dev \
libprotobuf-c0-dev \ libprotobuf-c0-dev \
libprotobuf-dev \ libprotobuf-dev \
@ -45,7 +45,8 @@ RUN apt-get update && apt-get install -y \
protobuf-compiler \ protobuf-compiler \
protobuf-c-compiler \ protobuf-c-compiler \
python-protobuf \ python-protobuf \
&& mkdir -p /usr/src/criu \ && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/criu \
&& curl -sSL https://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \ && curl -sSL https://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \
&& cd /usr/src/criu \ && cd /usr/src/criu \
&& make \ && make \
@ -84,7 +85,10 @@ RUN set -x \
&& rm -rf "$GOPATH" && rm -rf "$GOPATH"
FROM base AS frozen-images FROM base AS frozen-images
RUN apt-get update && apt-get install -y jq ca-certificates --no-install-recommends RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
jq \
&& rm -rf /var/lib/apt/lists/*
# Get useful and necessary Hub images so we can "docker load" locally instead of pulling # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
COPY contrib/download-frozen-image-v2.sh / COPY contrib/download-frozen-image-v2.sh /
RUN /download-frozen-image-v2.sh /build \ RUN /download-frozen-image-v2.sh /build \
@ -102,28 +106,27 @@ RUN dpkg --add-architecture armhf
RUN dpkg --add-architecture arm64 RUN dpkg --add-architecture arm64
RUN dpkg --add-architecture armel RUN dpkg --add-architecture armel
RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \ RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
apt-get update \ apt-get update && apt-get install -y --no-install-recommends \
&& apt-get install -y --no-install-recommends \
crossbuild-essential-armhf \ crossbuild-essential-armhf \
crossbuild-essential-arm64 \ crossbuild-essential-arm64 \
crossbuild-essential-armel; \ crossbuild-essential-armel \
&& rm -rf /var/lib/apt/lists/*; \
fi fi
FROM cross-${CROSS} as dev-base FROM cross-${CROSS} as dev-base
FROM dev-base AS runtime-dev-cross-false FROM dev-base AS runtime-dev-cross-false
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y --no-install-recommends \
libapparmor-dev \ libapparmor-dev \
libseccomp-dev libseccomp-dev \
&& rm -rf /var/lib/apt/lists/*
FROM cross-true AS runtime-dev-cross-true FROM cross-true AS runtime-dev-cross-true
# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install # These crossbuild packages rely on gcc-<arch>, but this doesn't want to install
# on non-amd64 systems. # on non-amd64 systems.
# Additionally, the crossbuild-amd64 is currently only on debian:buster, so # Additionally, the crossbuild-amd64 is currently only on debian:buster, so
# other architectures cannnot crossbuild amd64. # other architectures cannnot crossbuild amd64.
RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \ RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
apt-get update \ apt-get update && apt-get install -y --no-install-recommends \
&& apt-get install -y \
libseccomp-dev:armhf \ libseccomp-dev:armhf \
libseccomp-dev:arm64 \ libseccomp-dev:arm64 \
libseccomp-dev:armel \ libseccomp-dev:armel \
@ -133,7 +136,8 @@ RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
# install this arches seccomp here due to compat issues with the v0 builder # install this arches seccomp here due to compat issues with the v0 builder
# This is as opposed to inheriting from runtime-dev-cross-false # This is as opposed to inheriting from runtime-dev-cross-false
libapparmor-dev \ libapparmor-dev \
libseccomp-dev; \ libseccomp-dev \
&& rm -rf /var/lib/apt/lists/*; \
fi fi
FROM runtime-dev-cross-${CROSS} AS runtime-dev FROM runtime-dev-cross-${CROSS} AS runtime-dev
@ -151,7 +155,9 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
FROM dev-base AS containerd FROM dev-base AS containerd
RUN apt-get update && apt-get install -y btrfs-tools RUN apt-get update && apt-get install -y --no-install-recommends \
btrfs-tools \
&& rm -rf /var/lib/apt/lists/*
ENV INSTALL_BINARY_NAME=containerd ENV INSTALL_BINARY_NAME=containerd
COPY hack/dockerfile/install/install.sh ./install.sh COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
@ -188,7 +194,10 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
FROM dev-base AS tini FROM dev-base AS tini
RUN apt-get update && apt-get install -y cmake vim-common RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
vim-common \
&& rm -rf /var/lib/apt/lists/*
COPY hack/dockerfile/install/install.sh ./install.sh COPY hack/dockerfile/install/install.sh ./install.sh
ENV INSTALL_BINARY_NAME=tini ENV INSTALL_BINARY_NAME=tini
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
@ -213,7 +222,7 @@ RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker
RUN ldconfig RUN ldconfig
# This should only install packages that are specifically needed for the dev environment and nothing else # This should only install packages that are specifically needed for the dev environment and nothing else
# Do you really need to add another package here? Can it be done in a different build stage? # Do you really need to add another package here? Can it be done in a different build stage?
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y --no-install-recommends \
apparmor \ apparmor \
aufs-tools \ aufs-tools \
bash-completion \ bash-completion \
@ -240,7 +249,7 @@ RUN apt-get update && apt-get install -y \
libprotobuf-c1 \ libprotobuf-c1 \
libnet1 \ libnet1 \
libnl-3-200 \ libnl-3-200 \
--no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN pip3 install yamllint==1.16.0 RUN pip3 install yamllint==1.16.0