11# syntax=docker/dockerfile:1
22
33ARG BASE_VARIANT=alpine
4- ARG GO_VERSION=1.21.3
54ARG ALPINE_VERSION=3.17
5+ ARG BASE_DEBIAN_DISTRO=bookworm
6+
7+ ARG GO_VERSION=1.21.3
68ARG XX_VERSION=1.2.1
79ARG GOVERSIONINFO_VERSION=v1.3.0
810ARG GOTESTSUM_VERSION=v1.10.0
@@ -22,22 +24,15 @@ ARG TARGETPLATFORM
2224# gcc is installed for libgcc only
2325RUN xx-apk add --no-cache musl-dev gcc
2426
25- FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-bullseye
27+ FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO} AS build-base-debian
2628ENV GOTOOLCHAIN=local
2729COPY --link --from=xx / /
2830RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld llvm file
2931WORKDIR /go/src/github.com/docker/cli
3032
31- FROM build-base-bullseye AS build-bullseye
33+ FROM build-base-debian AS build-debian
3234ARG TARGETPLATFORM
33- RUN xx-apt-get install --no-install-recommends -y libc6-dev libgcc-10-dev
34- # workaround for issue with llvm 11 for darwin/amd64 platform:
35- # # github.com/docker/cli/cmd/docker
36- # /usr/local/go/pkg/tool/linux_amd64/link: /usr/local/go/pkg/tool/linux_amd64/link: running strip failed: exit status 1
37- # llvm-strip: error: unsupported load command (cmd=0x5)
38- # more info: https://github.com/docker/cli/pull/3717
39- # FIXME: remove once llvm 12 available on debian
40- RUN [ "$TARGETPLATFORM" != "darwin/amd64" ] || ln -sfnT /bin/true /usr/bin/llvm-strip
35+ RUN xx-apt-get install --no-install-recommends -y libc6-dev libgcc-12-dev pkgconf
4136
4237FROM build-base-${BASE_VARIANT} AS goversioninfo
4338ARG GOVERSIONINFO_VERSION
@@ -66,8 +61,6 @@ ARG VERSION
6661# PACKAGER_NAME sets the company that produced the windows binary
6762ARG PACKAGER_NAME
6863COPY --link --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
69- # in bullseye arm64 target does not link with lld so configure it to use ld instead
70- RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true
7164RUN --mount=type=bind,target=.,ro \
7265 --mount=type=cache,target=/root/.cache \
7366 --mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk \
@@ -103,7 +96,7 @@ RUN --mount=ro --mount=type=cache,target=/root/.cache \
10396FROM build-base-alpine AS e2e-base-alpine
10497RUN apk add --no-cache build-base curl openssl openssh-client
10598
106- FROM build-base-bullseye AS e2e-base-bullseye
99+ FROM build-base-debian AS e2e-base-debian
107100RUN apt-get update && apt-get install -y build-essential curl openssl openssh-client
108101
109102FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
0 commit comments