diff --git a/pkg/buildx/Makefile b/pkg/buildx/Makefile index d2592028..9ca509e2 100644 --- a/pkg/buildx/Makefile +++ b/pkg/buildx/Makefile @@ -26,7 +26,7 @@ export BUILDX_REF := $(if $(BUILDX_REF),$(BUILDX_REF),master) PKG_LIST ?= deb rpm static # supported platforms: https://github.com/docker/buildx/blob/master/docker-bake.hcl#L110-L122 # FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) -PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/riscv64 linux/s390x windows/amd64 windows/arm64 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/arm64 linux/riscv64 linux/s390x windows/amd64 windows/arm64 .PHONY: default default: pkg ; diff --git a/pkg/compose/Dockerfile b/pkg/compose/Dockerfile index aa284c83..eb390824 100644 --- a/pkg/compose/Dockerfile +++ b/pkg/compose/Dockerfile @@ -157,7 +157,32 @@ RUN --mount=type=bind,source=scripts/pkg-rpm-build.sh,target=/usr/local/bin/pkg- OUTDIR=/out SRCDIR=/usr/local/src/compose pkg-rpm-build # static -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static +FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static-nosdk +COPY --from=xx / / +ARG DEBIAN_FRONTEND +RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates file git zip tar \ + dpkg-dev clang lld llvm make pkg-config +ENV GOPROXY="https://proxy.golang.org|direct" +ENV GOPATH="/go" +ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" +ENV GO111MODULE="on" +ENV CGO_ENABLED="0" +ARG PKG_NAME +ARG COMPOSE_REF +ARG NIGHTLY_BUILD +WORKDIR /build +ARG TARGETPLATFORM +RUN xx-apt-get install -y gcc libc6-dev +RUN --mount=type=bind,source=scripts/pkg-static-build.sh,target=/usr/local/bin/pkg-static-build \ + --mount=type=bind,from=common-scripts,source=gen-ver.sh,target=/usr/local/bin/gen-ver \ + --mount=type=bind,from=common-scripts,source=fix-cc.sh,target=/usr/local/bin/fix-cc \ + --mount=type=bind,from=src,source=/src,target=/usr/local/src/compose \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + OUTDIR=/out BUILDDIR=/build SRCDIR=/usr/local/src/compose pkg-static-build +FROM builder-static-nosdk AS builder-static-linux +FROM builder-static-nosdk AS builder-static-windows + +FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static-darwin COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates file git zip tar \ @@ -181,6 +206,8 @@ RUN --mount=type=bind,source=scripts/pkg-static-build.sh,target=/usr/local/bin/p --mount=from=osxsdk,target=/xx-sdk,src=/xx-sdk \ OUTDIR=/out BUILDDIR=/build SRCDIR=/usr/local/src/compose pkg-static-build +FROM builder-static-$TARGETOS AS builder-static + FROM builder-${PKG_TYPE} AS build-pkg ARG BUILDKIT_SBOM_SCAN_STAGE=true diff --git a/pkg/compose/Makefile b/pkg/compose/Makefile index c6cb682f..a29a153c 100644 --- a/pkg/compose/Makefile +++ b/pkg/compose/Makefile @@ -26,7 +26,7 @@ export COMPOSE_REF := $(if $(COMPOSE_REF),$(COMPOSE_REF),v2) PKG_LIST ?= deb rpm static # supported platforms: https://github.com/docker/compose/blob/v2/docker-bake.hcl#L95-L107 # FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) -PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/riscv64 linux/s390x windows/amd64 windows/arm64 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/arm64 linux/riscv64 linux/s390x windows/amd64 windows/arm64 .PHONY: default default: pkg ; diff --git a/pkg/containerd/Makefile b/pkg/containerd/Makefile index 166e2209..24d45d10 100644 --- a/pkg/containerd/Makefile +++ b/pkg/containerd/Makefile @@ -32,7 +32,7 @@ PKG_LIST ?= deb rpm static # FIXME: can't build static binaries with containerd Makefile for darwin/amd64 darwin/arm64 windows/amd64 platforms # FIXME: linux/riscv64 needs ubuntu:22.04 image # FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) -PKG_PLATFORMS ?= linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x +PKG_PLATFORMS ?= linux/amd64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x .PHONY: default default: pkg ; diff --git a/pkg/credential-helpers/Dockerfile b/pkg/credential-helpers/Dockerfile index 890cc312..036dc598 100644 --- a/pkg/credential-helpers/Dockerfile +++ b/pkg/credential-helpers/Dockerfile @@ -153,7 +153,32 @@ RUN --mount=type=bind,source=scripts/pkg-rpm-build.sh,target=/usr/local/bin/pkg- OUTDIR=/out SRCDIR=/usr/local/src/docker-credential-helpers pkg-rpm-build # static -FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static +FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static-nosdk +COPY --from=xx / / +ARG DEBIAN_FRONTEND +RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates file git zip tar \ + dpkg-dev clang make pkg-config +ENV GOPROXY="https://proxy.golang.org|direct" +ENV GOPATH="/go" +ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" +ENV GO111MODULE="on" +ENV CGO_ENABLED="1" +ARG PKG_NAME +ARG CREDENTIAL_HELPERS_REF +ARG NIGHTLY_BUILD +WORKDIR /build +ARG TARGETPLATFORM +RUN xx-apt-get install -y gcc libsecret-1-dev +RUN --mount=type=bind,source=scripts/pkg-static-build.sh,target=/usr/local/bin/pkg-static-build \ + --mount=type=bind,from=common-scripts,source=gen-ver.sh,target=/usr/local/bin/gen-ver \ + --mount=type=bind,from=common-scripts,source=fix-cc.sh,target=/usr/local/bin/fix-cc \ + --mount=type=bind,from=src,source=/src,target=/usr/local/src/credential-helpers \ + --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \ + OUTDIR=/out BUILDDIR=/build SRCDIR=/usr/local/src/credential-helpers pkg-static-build +FROM builder-static-nosdk AS builder-static-linux +FROM builder-static-nosdk AS builder-static-windows + +FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS builder-static-darwin COPY --from=xx / / ARG DEBIAN_FRONTEND RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates file git zip tar \ @@ -177,6 +202,8 @@ RUN --mount=type=bind,source=scripts/pkg-static-build.sh,target=/usr/local/bin/p --mount=from=osxsdk,target=/xx-sdk,src=/xx-sdk \ OUTDIR=/out BUILDDIR=/build SRCDIR=/usr/local/src/credential-helpers pkg-static-build +FROM builder-static-$TARGETOS AS builder-static + FROM builder-${PKG_TYPE} AS build-pkg ARG BUILDKIT_SBOM_SCAN_STAGE=true diff --git a/pkg/credential-helpers/Makefile b/pkg/credential-helpers/Makefile index 8501756c..b343ec75 100644 --- a/pkg/credential-helpers/Makefile +++ b/pkg/credential-helpers/Makefile @@ -26,7 +26,7 @@ export CREDENTIAL_HELPERS_REF := $(if $(CREDENTIAL_HELPERS_REF),$(CREDENTIAL_HEL PKG_LIST ?= deb rpm static # supported platforms: https://github.com/docker/docker-credential-helpers/blob/master/docker-bake.hcl#L56-L66 # FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU) -PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x windows/amd64 +PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x windows/amd64 .PHONY: default default: pkg ;