From c5194a9e5dc117f4647e65cd57c0380019a98934 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 10 Jul 2023 12:57:31 +0200 Subject: [PATCH 1/2] Dockerfile: update to debian bookworm Signed-off-by: CrazyMax --- .github/workflows/e2e.yml | 2 +- Dockerfile | 17 ++++------------- docker-bake.hcl | 6 +++--- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c4362d36ed..0127bfd66d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -26,7 +26,7 @@ jobs: - connhelper-ssh base: - alpine - - bullseye + - bookworm 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 c1d3082da2..8b761200a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,22 +22,15 @@ ARG TARGETPLATFORM # gcc is installed for libgcc only RUN xx-apk add --no-cache musl-dev gcc -FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-bullseye +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS build-base-bookworm ENV GOTOOLCHAIN=local COPY --link --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-bullseye AS build-bullseye +FROM build-base-bookworm AS build-bookworm ARG TARGETPLATFORM -RUN xx-apt-get install --no-install-recommends -y libc6-dev libgcc-10-dev -# workaround for issue with llvm 11 for darwin/amd64 platform: -# # github.com/docker/cli/cmd/docker -# /usr/local/go/pkg/tool/linux_amd64/link: /usr/local/go/pkg/tool/linux_amd64/link: running strip failed: exit status 1 -# llvm-strip: error: unsupported load command (cmd=0x5) -# more info: https://github.com/docker/cli/pull/3717 -# FIXME: remove once llvm 12 available on debian -RUN [ "$TARGETPLATFORM" != "darwin/amd64" ] || ln -sfnT /bin/true /usr/bin/llvm-strip +RUN xx-apt-get install --no-install-recommends -y libc6-dev libgcc-12-dev pkgconf FROM build-base-${BASE_VARIANT} AS goversioninfo ARG GOVERSIONINFO_VERSION @@ -66,8 +59,6 @@ ARG VERSION # PACKAGER_NAME sets the company that produced the windows binary ARG PACKAGER_NAME COPY --link --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo -# in bullseye arm64 target does not link with lld so configure it to use ld instead -RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true RUN --mount=type=bind,target=.,ro \ --mount=type=cache,target=/root/.cache \ --mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk \ @@ -103,7 +94,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 openssl openssh-client -FROM build-base-bullseye AS e2e-base-bullseye +FROM build-base-bookworm AS e2e-base-bookworm RUN apt-get update && apt-get install -y build-essential curl openssl openssh-client FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx diff --git a/docker-bake.hcl b/docker-bake.hcl index 21c3687201..18190ecc89 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" ? "bullseye" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "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" ? "bullseye" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "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" ? "bullseye" : "alpine" + BASE_VARIANT = USE_GLIBC == "1" ? "bookworm" : "alpine" VERSION = VERSION } } From 0d95231ccb00a51190131353546995456fdd0615 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 10 Jul 2023 13:01:07 +0200 Subject: [PATCH 2/2] Dockerfile: use "debian" in stages instead of distro name Signed-off-by: CrazyMax --- .github/workflows/e2e.yml | 2 +- Dockerfile | 10 ++++++---- docker-bake.hcl | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0127bfd66d..60f99c5690 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 8b761200a5..5cab275ba1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ # syntax=docker/dockerfile:1 ARG BASE_VARIANT=alpine -ARG GO_VERSION=1.21.3 ARG ALPINE_VERSION=3.17 +ARG BASE_DEBIAN_DISTRO=bookworm + +ARG GO_VERSION=1.21.3 ARG XX_VERSION=1.2.1 ARG GOVERSIONINFO_VERSION=v1.3.0 ARG GOTESTSUM_VERSION=v1.10.0 @@ -22,13 +24,13 @@ 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 ENV GOTOOLCHAIN=local COPY --link --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 @@ -94,7 +96,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 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 FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx diff --git a/docker-bake.hcl b/docker-bake.hcl index 18190ecc89..e8a2ddbf3a 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 } }