From b6c736ef2289558233be9f18c15ff3a560ecb1bb Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 10 Jul 2023 13:01:07 +0200 Subject: [PATCH] Dockerfile: use "debian" in stages instead of distro name Signed-off-by: CrazyMax --- .github/workflows/e2e.yml | 2 +- Dockerfile | 12 +++++++----- docker-bake.hcl | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4c105f368624..f8a1d7348a5f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -26,7 +26,7 @@ jobs: - connhelper-ssh base: - alpine - - bookworm + - debian engine-version: # - 20.10-dind # FIXME: Fails on 20.10 - stable-dind # TODO: Use 20.10-dind, stable-dind is deprecated diff --git a/Dockerfile b/Dockerfile index 838616456bdb..5496bf079792 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ # syntax=docker/dockerfile:1 ARG BASE_VARIANT=alpine +ARG BASE_DEBIAN_DISTRO=bookworm +ARG BASE_ALPINE_VERSION=3.17 + ARG GO_VERSION=1.20.5 -ARG ALPINE_VERSION=3.17 ARG XX_VERSION=1.2.1 ARG GOVERSIONINFO_VERSION=v1.3.0 ARG GOTESTSUM_VERSION=v1.10.0 @@ -10,7 +12,7 @@ ARG BUILDX_VERSION=0.11.0 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx -FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build-base-alpine +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${BASE_ALPINE_VERSION} AS build-base-alpine COPY --from=xx / / RUN apk add --no-cache bash clang lld llvm file git WORKDIR /go/src/github.com/docker/cli @@ -20,12 +22,12 @@ ARG TARGETPLATFORM # gcc is installed for libgcc only RUN xx-apk add --no-cache musl-dev gcc -FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS build-base-bookworm +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO} AS build-base-debian COPY --from=xx / / RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld llvm file WORKDIR /go/src/github.com/docker/cli -FROM build-base-bookworm AS build-bookworm +FROM build-base-debian AS build-debian ARG TARGETPLATFORM RUN xx-apt-get install --no-install-recommends -y libc6-dev libgcc-12-dev pkgconf @@ -91,7 +93,7 @@ RUN --mount=ro --mount=type=cache,target=/root/.cache \ FROM build-base-alpine AS e2e-base-alpine RUN apk add --no-cache build-base curl docker-compose openssl openssh-client -FROM build-base-bookworm AS e2e-base-bookworm +FROM build-base-debian AS e2e-base-debian RUN apt-get update && apt-get install -y build-essential curl openssl openssh-client ARG COMPOSE_VERSION=1.29.2 RUN curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && \ diff --git a/docker-bake.hcl b/docker-bake.hcl index b49b4bc4414f..e02c7d9d8c29 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -52,7 +52,7 @@ target "binary" { platforms = ["local"] output = ["build"] args = { - BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine" VERSION = VERSION PACKAGER_NAME = PACKAGER_NAME GO_STRIP = STRIP_TARGET @@ -72,7 +72,7 @@ target "plugins" { platforms = ["local"] output = ["build"] args = { - BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine" VERSION = VERSION GO_STRIP = STRIP_TARGET } @@ -155,7 +155,7 @@ target "e2e-image" { output = ["type=docker"] tags = ["${IMAGE_NAME}"] args = { - BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine" VERSION = VERSION } }