From 9e72c44daea2cbc485dd0c3d43c161c3fe156711 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 2 Dec 2025 16:47:39 +0900 Subject: [PATCH] rm -r hack/dockerfile/install The directory was solely used by Dockerfile.simple. For the "simple" mode, we can just directly apt-get the dependencies. A part of issue 51637 Signed-off-by: Akihiro Suda --- Dockerfile | 1 - Dockerfile.simple | 26 ++++++++++--- Dockerfile.windows | 2 +- hack/dockerfile/install/containerd.installer | 36 ----------------- hack/dockerfile/install/dockercli.installer | 30 -------------- hack/dockerfile/install/install.sh | 39 ------------------- hack/dockerfile/install/rootlesskit.installer | 31 --------------- hack/dockerfile/install/runc.installer | 27 ------------- hack/dockerfile/install/tini.installer | 17 -------- 9 files changed, 21 insertions(+), 188 deletions(-) delete mode 100755 hack/dockerfile/install/containerd.installer delete mode 100755 hack/dockerfile/install/dockercli.installer delete mode 100755 hack/dockerfile/install/install.sh delete mode 100755 hack/dockerfile/install/rootlesskit.installer delete mode 100755 hack/dockerfile/install/runc.installer delete mode 100755 hack/dockerfile/install/tini.installer diff --git a/Dockerfile b/Dockerfile index 51a7232606..bb29d3f27e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -321,7 +321,6 @@ FROM tini-${TARGETOS} AS tini FROM base AS rootlesskit-src WORKDIR /usr/src/rootlesskit RUN git init . && git remote add origin "https://github.com/rootless-containers/rootlesskit.git" -# When updating, also update go.mod and hack/dockerfile/install/rootlesskit.installer accordingly. ARG ROOTLESSKIT_VERSION=v2.3.5 RUN git fetch -q --depth 1 origin "${ROOTLESSKIT_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD diff --git a/Dockerfile.simple b/Dockerfile.simple index 9eba324e26..ed1cbd558a 100644 --- a/Dockerfile.simple +++ b/Dockerfile.simple @@ -34,12 +34,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ vim-common \ && rm -rf /var/lib/apt/lists/* -# Install runc, containerd, and tini -# Please edit hack/dockerfile/install/.installer to update them. -COPY hack/dockerfile/install hack/dockerfile/install -RUN set -e; for i in runc containerd tini dockercli; \ - do hack/dockerfile/install/install.sh $i; \ - done +# Install containerd.io (includes runc), tini, and docker-ce-cli. +# The versions of these dependencies differ from the main Dockerfile, +# but it should be sufficient for minimal build and test purposes. +ADD --chmod=0644 --checksum=sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570 \ + https://download.docker.com/linux/debian/gpg /etc/apt/keyrings/docker.asc +ARG BASE_DEBIAN_DISTRO +ADD <<-EOT /etc/apt/sources.list.d/docker.sources +Types: deb +URIs: https://download.docker.com/linux/debian +Suites: ${BASE_DEBIAN_DISTRO} +Components: stable +Signed-By: /etc/apt/keyrings/docker.asc +EOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + containerd.io \ + tini \ + docker-ce-cli \ + && rm -rf /var/lib/apt/lists/* \ + && ln -s /usr/bin/tini-static /usr/local/bin/docker-init + ENV PATH=/usr/local/cli:$PATH ENV AUTO_GOPATH 1 diff --git a/Dockerfile.windows b/Dockerfile.windows index 9f2dd9c95d..ee1b3238c9 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -175,7 +175,7 @@ ARG CONTAINERD_VERSION=v2.0.7 # Environment variable notes: # - GO_VERSION must be consistent with 'Dockerfile' used by Linux. -# - CONTAINERD_VERSION must be consistent with 'hack/dockerfile/install/containerd.installer' used by Linux. +# - CONTAINERD_VERSION must be consistent with 'Dockerfile' used by Linux. # - FROM_DOCKERFILE is used for detection of building within a container. ENV GO_VERSION=${GO_VERSION} ` CONTAINERD_VERSION=${CONTAINERD_VERSION} ` diff --git a/hack/dockerfile/install/containerd.installer b/hack/dockerfile/install/containerd.installer deleted file mode 100755 index 24becb6124..0000000000 --- a/hack/dockerfile/install/containerd.installer +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -set -e - -# CONTAINERD_VERSION specifies the version of the containerd runtime binary -# to install from the https://github.com/containerd/containerd repository. -# -# This version is used to build statically compiled containerd binaries, and -# used for the integration tests. The distributed docker .deb and .rpm packages -# depend on a separate (containerd.io) package, which may be a different version -# as is specified here. -# -# Generally, the commit specified here should match a tagged release. -: "${CONTAINERD_VERSION:=v2.2.0}" - -install_containerd() ( - echo "Install containerd version $CONTAINERD_VERSION" - git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd" - cd "$GOPATH/src/github.com/containerd/containerd" - git checkout -q "$CONTAINERD_VERSION" - - export BUILDTAGS='netgo osusergo static_build' - export EXTRA_FLAGS=${GO_BUILDMODE} - export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"' - - # Reset build flags to nothing if we want a dynbinary - if [ "$1" = "dynamic" ]; then - export BUILDTAGS='' - export EXTRA_FLAGS='' - export EXTRA_LDFLAGS='' - fi - make - - install -D bin/containerd "${PREFIX}/containerd" - install -D bin/containerd-shim-runc-v2 "${PREFIX}/containerd-shim-runc-v2" - install -D bin/ctr "${PREFIX}/ctr" -) diff --git a/hack/dockerfile/install/dockercli.installer b/hack/dockerfile/install/dockercli.installer deleted file mode 100755 index 7c6e265e58..0000000000 --- a/hack/dockerfile/install/dockercli.installer +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -: ${DOCKERCLI_CHANNEL:=stable} -: ${DOCKERCLI_VERSION:=18.06.3-ce} - -install_dockercli() { - echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL" - - arch=$(uname -m) - # No official release of these platforms - if [ "$arch" != "x86_64" ] && [ "$arch" != "s390x" ] && [ "$arch" != "armhf" ]; then - build_dockercli - return - fi - - url=https://download.docker.com/linux/static - curl -Ls "${url}/${DOCKERCLI_CHANNEL}/${arch}/docker-${DOCKERCLI_VERSION}.tgz" | tar -xz docker/docker - mkdir -p "${PREFIX}" - mv docker/docker "${PREFIX}/" - rmdir docker -} - -build_dockercli() { - git clone https://github.com/docker/docker-ce "$GOPATH/tmp/docker-ce" - cd "$GOPATH/tmp/docker-ce" - git checkout -q "v$DOCKERCLI_VERSION" - mkdir -p "$GOPATH/src/github.com/docker" - mv components/cli "$GOPATH/src/github.com/docker/cli" - go build ${GO_BUILDMODE} -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker" -} diff --git a/hack/dockerfile/install/install.sh b/hack/dockerfile/install/install.sh deleted file mode 100755 index 7629acd800..0000000000 --- a/hack/dockerfile/install/install.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -set -e -set -x - -RM_GOPATH=0 - -TMP_GOPATH=${TMP_GOPATH:-""} - -: ${PREFIX:="/usr/local/bin"} - -if [ -z "$TMP_GOPATH" ]; then - export GOPATH="$(mktemp -d)" - RM_GOPATH=1 -else - export GOPATH="$TMP_GOPATH" -fi -case "$(go env GOARCH)" in - mips* | ppc64) - # pie build mode is not supported on mips architectures - export GO_BUILDMODE="" - ;; - *) - export GO_BUILDMODE="-buildmode=pie" - ;; -esac - -dir="$(dirname $0)" - -bin=$1 -shift - -if [ ! -f "${dir}/${bin}.installer" ]; then - echo "Could not find installer for \"$bin\"" - exit 1 -fi - -. ${dir}/${bin}.installer -install_${bin} "$@" diff --git a/hack/dockerfile/install/rootlesskit.installer b/hack/dockerfile/install/rootlesskit.installer deleted file mode 100755 index 50d3cf8e3b..0000000000 --- a/hack/dockerfile/install/rootlesskit.installer +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# When updating, also update go.mod and Dockerfile accordingly. -: "${ROOTLESSKIT_VERSION:=v2.3.5}" - -install_rootlesskit() { - case "$1" in - "dynamic") - install_rootlesskit_dynamic - return - ;; - "") - export CGO_ENABLED=0 - _install_rootlesskit - ;; - *) - echo 'Usage: $0 [dynamic]' - ;; - esac -} - -install_rootlesskit_dynamic() { - export ROOTLESSKIT_LDFLAGS="-linkmode=external" install_rootlesskit - export BUILD_MODE=${GO_BUILDMODE} - _install_rootlesskit -} - -_install_rootlesskit() ( - echo "Install rootlesskit version ${ROOTLESSKIT_VERSION}" - GOBIN="${PREFIX}" go install ${BUILD_MODE} -ldflags="$ROOTLESSKIT_LDFLAGS" "github.com/rootless-containers/rootlesskit/v2/cmd/rootlesskit@${ROOTLESSKIT_VERSION}" -) diff --git a/hack/dockerfile/install/runc.installer b/hack/dockerfile/install/runc.installer deleted file mode 100755 index f4d770d18e..0000000000 --- a/hack/dockerfile/install/runc.installer +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -set -e - -# RUNC_VERSION specifies the version of runc to install from the -# https://github.com/opencontainers/runc repository. -# -# The version of runc should match the version that is used by the containerd -# version that is used. If you need to update runc, open a pull request in -# the containerd project first, and update both after that is merged. -: "${RUNC_VERSION:=v1.3.4}" - -install_runc() { - RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp"}" - - echo "Install runc version $RUNC_VERSION (build tags: $RUNC_BUILDTAGS)" - git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" - cd "$GOPATH/src/github.com/opencontainers/runc" - git checkout -q "$RUNC_VERSION" - if [ -z "$1" ]; then - target=static - else - target="$1" - fi - make BUILDTAGS="$RUNC_BUILDTAGS" "$target" - mkdir -p "${PREFIX}" - cp runc "${PREFIX}/runc" -} diff --git a/hack/dockerfile/install/tini.installer b/hack/dockerfile/install/tini.installer deleted file mode 100755 index febceb15eb..0000000000 --- a/hack/dockerfile/install/tini.installer +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# TINI_VERSION specifies the version of tini (docker-init) to build, and install -# from the https://github.com/krallin/tini repository. This binary is used -# when starting containers with the `--init` option. -: "${TINI_VERSION:=v0.19.0}" - -install_tini() { - echo "Install tini version $TINI_VERSION" - git clone https://github.com/krallin/tini.git "$GOPATH/tini" - cd "$GOPATH/tini" - git checkout -q "$TINI_VERSION" - cmake . - make tini-static - mkdir -p "${PREFIX}" - cp tini-static "${PREFIX}/docker-init" -}