2626
2727ARG CROSS="false"
2828ARG GO_VERSION=1.12.8
29+ ARG DEBIAN_FRONTEND=noninteractive
2930
3031FROM golang:${GO_VERSION}-stretch AS base
3132ARG APT_MIRROR
3233RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
3334 && sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
3435
3536FROM base AS criu
37+ ARG DEBIAN_FRONTEND
3638# Install CRIU for checkpoint/restore support
3739ENV CRIU_VERSION 3.11
3840# Install dependency packages specific to criu
39- RUN apt-get update && apt-get install -y \
41+ RUN apt-get update && apt-get install -y --no-install-recommends \
4042 libnet-dev \
41- libprotobuf-c0 -dev \
43+ libprotobuf-c -dev \
4244 libprotobuf-dev \
4345 libnl-3-dev \
4446 libcap-dev \
4547 protobuf-compiler \
4648 protobuf-c-compiler \
4749 python-protobuf \
48- && mkdir -p /usr/src/criu \
50+ && rm -rf /var/lib/apt/lists/*
51+ RUN mkdir -p /usr/src/criu \
4952 && curl -sSL https://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \
5053 && cd /usr/src/criu \
5154 && make \
@@ -84,7 +87,11 @@ RUN set -x \
8487 && rm -rf "$GOPATH"
8588
8689FROM base AS frozen-images
87- RUN apt-get update && apt-get install -y jq ca-certificates --no-install-recommends
90+ ARG DEBIAN_FRONTEND
91+ RUN apt-get update && apt-get install -y --no-install-recommends \
92+ ca-certificates \
93+ jq \
94+ && rm -rf /var/lib/apt/lists/*
8895# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
8996COPY contrib/download-frozen-image-v2.sh /
9097RUN /download-frozen-image-v2.sh /build \
@@ -98,32 +105,34 @@ RUN /download-frozen-image-v2.sh /build \
98105FROM base AS cross-false
99106
100107FROM base AS cross-true
108+ ARG DEBIAN_FRONTEND
101109RUN dpkg --add-architecture armhf
102110RUN dpkg --add-architecture arm64
103111RUN dpkg --add-architecture armel
104112RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
105- apt-get update \
106- && apt-get install -y --no-install-recommends \
113+ apt-get update && apt-get install -y --no-install-recommends \
107114 crossbuild-essential-armhf \
108115 crossbuild-essential-arm64 \
109- crossbuild-essential-armel; \
116+ crossbuild-essential-armel \
117+ && rm -rf /var/lib/apt/lists/*; \
110118 fi
111119
112120FROM cross-${CROSS} as dev-base
113121
114122FROM dev-base AS runtime-dev-cross-false
115- RUN apt-get update && apt-get install -y \
123+ ARG DEBIAN_FRONTEND
124+ RUN apt-get update && apt-get install -y --no-install-recommends \
116125 libapparmor-dev \
117- libseccomp-dev
118-
126+ libseccomp-dev \
127+ && rm -rf /var/lib/apt/lists/*
119128FROM cross-true AS runtime-dev-cross-true
129+ ARG DEBIAN_FRONTEND
120130# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install
121131# on non-amd64 systems.
122132# Additionally, the crossbuild-amd64 is currently only on debian:buster, so
123133# other architectures cannnot crossbuild amd64.
124134RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
125- apt-get update \
126- && apt-get install -y \
135+ apt-get update && apt-get install -y --no-install-recommends \
127136 libseccomp-dev:armhf \
128137 libseccomp-dev:arm64 \
129138 libseccomp-dev:armel \
@@ -133,7 +142,8 @@ RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \
133142 # install this arches seccomp here due to compat issues with the v0 builder
134143 # This is as opposed to inheriting from runtime-dev-cross-false
135144 libapparmor-dev \
136- libseccomp-dev; \
145+ libseccomp-dev \
146+ && rm -rf /var/lib/apt/lists/*; \
137147 fi
138148
139149FROM runtime-dev-cross-${CROSS} AS runtime-dev
@@ -151,7 +161,10 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
151161RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
152162
153163FROM dev-base AS containerd
154- RUN apt-get update && apt-get install -y btrfs-tools
164+ ARG DEBIAN_FRONTEND
165+ RUN apt-get update && apt-get install -y --no-install-recommends \
166+ btrfs-tools \
167+ && rm -rf /var/lib/apt/lists/*
155168ENV INSTALL_BINARY_NAME=containerd
156169COPY hack/dockerfile/install/install.sh ./install.sh
157170COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
@@ -188,7 +201,11 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
188201RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
189202
190203FROM dev-base AS tini
191- RUN apt-get update && apt-get install -y cmake vim-common
204+ ARG DEBIAN_FRONTEND
205+ RUN apt-get update && apt-get install -y --no-install-recommends \
206+ cmake \
207+ vim-common \
208+ && rm -rf /var/lib/apt/lists/*
192209COPY hack/dockerfile/install/install.sh ./install.sh
193210ENV INSTALL_BINARY_NAME=tini
194211COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
@@ -203,6 +220,7 @@ COPY ./contrib/dockerd-rootless.sh /build
203220
204221# TODO: Some of this is only really needed for testing, it would be nice to split this up
205222FROM runtime-dev AS dev
223+ ARG DEBIAN_FRONTEND
206224RUN groupadd -r docker
207225RUN useradd --create-home --gid docker unprivilegeduser
208226# Let us use a .bashrc file
@@ -213,7 +231,7 @@ RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker
213231RUN ldconfig
214232# This should only install packages that are specifically needed for the dev environment and nothing else
215233# Do you really need to add another package here? Can it be done in a different build stage?
216- RUN apt-get update && apt-get install -y \
234+ RUN apt-get update && apt-get install -y --no-install-recommends \
217235 apparmor \
218236 aufs-tools \
219237 bash-completion \
@@ -230,6 +248,7 @@ RUN apt-get update && apt-get install -y \
230248 pigz \
231249 python3-pip \
232250 python3-setuptools \
251+ python3-wheel \
233252 thin-provisioning-tools \
234253 vim \
235254 vim-common \
@@ -240,7 +259,7 @@ RUN apt-get update && apt-get install -y \
240259 libprotobuf-c1 \
241260 libnet1 \
242261 libnl-3-200 \
243- --no-install-recommends
262+ && rm -rf /var/lib/apt/lists/*
244263
245264RUN pip3 install yamllint==1.16.0
246265
0 commit comments