Browse code

Dockerfile: update to Debian "bookworm" (current stable)

Also switch yamllint to be installed from debian's packages, which are
currently at v1.29.0.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/06/22 23:03:24
Showing 4 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 # syntax=docker/dockerfile:1
2 2
 
3 3
 ARG GO_VERSION=1.21.3
4
-ARG BASE_DEBIAN_DISTRO="bullseye"
4
+ARG BASE_DEBIAN_DISTRO="bookworm"
5 5
 ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
6 6
 ARG XX_VERSION=1.2.1
7 7
 
... ...
@@ -40,7 +40,7 @@ FROM --platform=$BUILDPLATFORM ${GOLANG_IMAGE} AS base
40 40
 COPY --from=xx / /
41 41
 RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
42 42
 ARG APT_MIRROR
43
-RUN test -n "$APT_MIRROR" && sed -ri "s#(httpredir|deb|security).debian.org#${APT_MIRROR}#g" /etc/apt/sources.list || true
43
+RUN test -n "$APT_MIRROR" && sed -ri "s#(httpredir|deb|security).debian.org#${APT_MIRROR}#g" /etc/apt/sources.list.d/debian.sources || true
44 44
 ARG DEBIAN_FRONTEND
45 45
 RUN apt-get update && apt-get install --no-install-recommends -y file
46 46
 ENV GO111MODULE=off
... ...
@@ -213,7 +213,10 @@ ARG TARGETPLATFORM
213 213
 RUN --mount=type=cache,sharing=locked,id=moby-containerd-aptlib,target=/var/lib/apt \
214 214
     --mount=type=cache,sharing=locked,id=moby-containerd-aptcache,target=/var/cache/apt \
215 215
         apt-get update && xx-apt-get install -y --no-install-recommends \
216
-            gcc libbtrfs-dev libsecret-1-dev
216
+            gcc \
217
+            libbtrfs-dev \
218
+            libsecret-1-dev \
219
+            pkg-config
217 220
 ARG DOCKER_STATIC
218 221
 RUN --mount=from=containerd-src,src=/usr/src/containerd,rw \
219 222
     --mount=type=cache,target=/root/.cache/go-build,id=containerd-build-$TARGETPLATFORM <<EOT
... ...
@@ -296,7 +299,11 @@ ARG TARGETPLATFORM
296 296
 RUN --mount=type=cache,sharing=locked,id=moby-runc-aptlib,target=/var/lib/apt \
297 297
     --mount=type=cache,sharing=locked,id=moby-runc-aptcache,target=/var/cache/apt \
298 298
         apt-get update && xx-apt-get install -y --no-install-recommends \
299
-            dpkg-dev gcc libc6-dev libseccomp-dev
299
+            dpkg-dev \
300
+            gcc \
301
+            libc6-dev \
302
+            libseccomp-dev \
303
+            pkg-config
300 304
 ARG DOCKER_STATIC
301 305
 RUN --mount=from=runc-src,src=/usr/src/runc,rw \
302 306
     --mount=type=cache,target=/root/.cache/go-build,id=runc-build-$TARGETPLATFORM <<EOT
... ...
@@ -331,7 +338,9 @@ ARG TARGETPLATFORM
331 331
 RUN --mount=type=cache,sharing=locked,id=moby-tini-aptlib,target=/var/lib/apt \
332 332
     --mount=type=cache,sharing=locked,id=moby-tini-aptcache,target=/var/cache/apt \
333 333
         xx-apt-get install -y --no-install-recommends \
334
-            gcc libc6-dev
334
+            gcc \
335
+            libc6-dev \
336
+            pkg-config
335 337
 RUN --mount=from=tini-src,src=/usr/src/tini,rw \
336 338
     --mount=type=cache,target=/root/.cache/go-build,id=tini-build-$TARGETPLATFORM <<EOT
337 339
   set -e
... ...
@@ -361,7 +370,9 @@ ARG TARGETPLATFORM
361 361
 RUN --mount=type=cache,sharing=locked,id=moby-rootlesskit-aptlib,target=/var/lib/apt \
362 362
     --mount=type=cache,sharing=locked,id=moby-rootlesskit-aptcache,target=/var/cache/apt \
363 363
         apt-get update && xx-apt-get install -y --no-install-recommends \
364
-            gcc libc6-dev
364
+            gcc \
365
+            libc6-dev \
366
+            pkg-config
365 367
 ENV GO111MODULE=on
366 368
 ARG DOCKER_STATIC
367 369
 RUN --mount=from=rootlesskit-src,src=/usr/src/rootlesskit,rw \
... ...
@@ -429,7 +440,11 @@ RUN git fetch -q --depth 1 origin "${CONTAINERUTILITY_VERSION}" +refs/tags/*:ref
429 429
 FROM base AS containerutil-build
430 430
 WORKDIR /usr/src/containerutil
431 431
 ARG TARGETPLATFORM
432
-RUN xx-apt-get install -y --no-install-recommends gcc g++ libc6-dev
432
+RUN xx-apt-get install -y --no-install-recommends \
433
+        gcc \
434
+        g++ \
435
+        libc6-dev \
436
+        pkg-config
433 437
 RUN --mount=from=containerutil-src,src=/usr/src/containerutil,rw \
434 438
     --mount=type=cache,target=/root/.cache/go-build,id=containerutil-build-$TARGETPLATFORM <<EOT
435 439
   set -e
... ...
@@ -529,9 +544,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
529 529
             net-tools \
530 530
             patch \
531 531
             pigz \
532
-            python3-pip \
533
-            python3-setuptools \
534
-            python3-wheel \
535 532
             sudo \
536 533
             systemd-journal-remote \
537 534
             thin-provisioning-tools \
... ...
@@ -547,8 +559,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
547 547
 RUN update-alternatives --set iptables  /usr/sbin/iptables-legacy  || true \
548 548
  && update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy || true \
549 549
  && update-alternatives --set arptables /usr/sbin/arptables-legacy || true
550
-ARG YAMLLINT_VERSION=1.27.1
551
-RUN pip3 install yamllint==${YAMLLINT_VERSION}
552 550
 RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
553 551
     --mount=type=cache,sharing=locked,id=moby-dev-aptcache,target=/var/cache/apt \
554 552
         apt-get update && apt-get install --no-install-recommends -y \
... ...
@@ -559,7 +569,8 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
559 559
             libseccomp-dev \
560 560
             libsecret-1-dev \
561 561
             libsystemd-dev \
562
-            libudev-dev
562
+            libudev-dev \
563
+            yamllint
563 564
 COPY --link --from=dockercli             /build/ /usr/local/cli
564 565
 COPY --link --from=dockercli-integration /build/ /usr/local/cli-integration
565 566
 
... ...
@@ -586,7 +597,8 @@ RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
586 586
             libseccomp-dev \
587 587
             libsecret-1-dev \
588 588
             libsystemd-dev \
589
-            libudev-dev
589
+            libudev-dev \
590
+            pkg-config
590 591
 ARG DOCKER_BUILDTAGS
591 592
 ARG DOCKER_DEBUG
592 593
 ARG DOCKER_GITCOMMIT=HEAD
... ...
@@ -7,7 +7,7 @@
7 7
 
8 8
 ARG GO_VERSION=1.21.3
9 9
 
10
-ARG BASE_DEBIAN_DISTRO="bullseye"
10
+ARG BASE_DEBIAN_DISTRO="bookworm"
11 11
 ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
12 12
 
13 13
 FROM ${GOLANG_IMAGE}
... ...
@@ -16,7 +16,7 @@ ENV GOTOOLCHAIN=local
16 16
 
17 17
 # allow replacing debian mirror
18 18
 ARG APT_MIRROR
19
-RUN test -n "$APT_MIRROR" && sed -ri "s#(httpredir|deb|security).debian.org#${APT_MIRROR}#g" /etc/apt/sources.list || true
19
+RUN test -n "$APT_MIRROR" && sed -ri "s#(httpredir|deb|security).debian.org#${APT_MIRROR}#g" /etc/apt/sources.list.d/debian.sources || true
20 20
 
21 21
 # Compile and runtime deps
22 22
 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
... ...
@@ -1,7 +1,7 @@
1 1
 # syntax=docker/dockerfile:1
2 2
 
3 3
 ARG GO_VERSION=1.21.3
4
-ARG BASE_DEBIAN_DISTRO="bullseye"
4
+ARG BASE_DEBIAN_DISTRO="bookworm"
5 5
 ARG PROTOC_VERSION=3.11.4
6 6
 
7 7
 # protoc is dynamically linked to glibc so can't use alpine base
... ...
@@ -1647,7 +1647,10 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
1647 1647
 	defer mount.Unmount(testDir)
1648 1648
 
1649 1649
 	// create a 3MiB image (with a 2MiB ext4 fs) and mount it as graph root
1650
-	// Why in a container? Because `mount` sometimes behaves weirdly and often fails outright on this test in debian:bullseye (which is what the test suite runs under if run from the Makefile)
1650
+	//
1651
+	// Why in a container? Because `mount` sometimes behaves weirdly and often
1652
+	// fails outright on this test in debian:jessie (which is what the test suite
1653
+	// runs under if run from the Makefile at the time this patch was added).
1651 1654
 	cli.DockerCmd(c, "run", "--rm", "-v", testDir+":/test", "busybox", "sh", "-c", "dd of=/test/testfs.img bs=1M seek=3 count=0")
1652 1655
 	icmd.RunCommand("mkfs.ext4", "-F", filepath.Join(testDir, "testfs.img")).Assert(c, icmd.Success)
1653 1656