Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion pkg/docker-cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,27 @@ ARG GOVERSIONINFO_VERSION
RUN --mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \
GOBIN=/out GO111MODULE=on go install "github.com/josephspurrier/goversioninfo/cmd/goversioninfo@${GOVERSIONINFO_VERSION}"

FROM build-base-static AS builder-static
FROM build-base-static AS builder-static-nosdk
ARG DEBIAN_FRONTEND
RUN apt-get install -y --no-install-recommends dpkg-dev clang lld llvm make pkg-config
ARG PKG_NAME
ARG DOCKER_CLI_REF
ARG NIGHTLY_BUILD
WORKDIR /build
ARG TARGETPLATFORM
RUN xx-apt-get install -y gcc libc6-dev
Comment on lines +187 to +195
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes a difference for caching, but some questions;

  • move the PKG_NAME and some of the other ones later?
  • do the apt-get and xx-apt-get steps have to be separate? (would it make sense to combine them otherwise?)
  • does xx-apt... use TARGETPLATFORM? If not, that one could be moved until after that step as well
Suggested change
FROM build-base-static AS builder-static-nosdk
ARG DEBIAN_FRONTEND
RUN apt-get install -y --no-install-recommends dpkg-dev clang lld llvm make pkg-config
ARG PKG_NAME
ARG DOCKER_CLI_REF
ARG NIGHTLY_BUILD
WORKDIR /build
ARG TARGETPLATFORM
RUN xx-apt-get install -y gcc libc6-dev
FROM build-base-static AS builder-static-nosdk
WORKDIR /build
ARG DEBIAN_FRONTEND
RUN xx-apt-get install -y --no-install-recommends \
clang \
dpkg-dev \
gcc \
libc6-dev \
lld \
llvm \
make \
pkg-config
ARG DOCKER_CLI_REF
ARG NIGHTLY_BUILD
ARG PKG_NAME
ARG TARGETPLATFORM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • move the PKG_NAME and some of the other ones later?

Yes good point, could be moved after xx-apt

  • do the apt-get and xx-apt-get steps have to be separate? (would it make sense to combine them otherwise?)

Yes they have because xx-apt-get is using TARGET_PLATFORM.

  • does xx-apt... use TARGETPLATFORM? If not, that one could be moved until after that step as well

Yes every xx-* command needs TARGETPLATFORM.

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=/go/src/github.com/docker/cli,rw \
--mount=type=bind,from=gocross,source=/usr/local/go,target=/usr/local/go,rw \
--mount=type=bind,from=goversioninfo,source=/out/goversioninfo,target=/usr/bin/goversioninfo \
--mount=type=tmpfs,target=/go/src/github.com/docker/cli/winresources \
OUTDIR=/out BUILDDIR=/build SRCDIR=/go/src/github.com/docker/cli pkg-static-build
FROM builder-static-nosdk AS builder-static-linux
FROM builder-static-nosdk AS builder-static-windows

FROM build-base-static AS builder-static-darwin
ARG DEBIAN_FRONTEND
RUN apt-get install -y --no-install-recommends dpkg-dev clang lld llvm make pkg-config
ARG PKG_NAME
Expand All @@ -203,6 +223,8 @@ RUN --mount=type=bind,source=scripts/pkg-static-build.sh,target=/usr/local/bin/p
--mount=type=tmpfs,target=/go/src/github.com/docker/cli/winresources \
OUTDIR=/out BUILDDIR=/build SRCDIR=/go/src/github.com/docker/cli pkg-static-build

FROM builder-static-$TARGETOS AS builder-static

FROM builder-${PKG_TYPE} AS build-pkg
ARG BUILDKIT_SBOM_SCAN_STAGE=true

Expand Down
2 changes: 1 addition & 1 deletion pkg/docker-cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export PKG_RPM_RELEASE = 3
PKG_LIST ?= deb rpm static
# supported platforms: https://github.com/docker/cli/blob/master/docker-bake.hcl#L30-L42
# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU)
PKG_PLATFORMS ?= darwin/amd64 darwin/arm64 linux/386 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/386 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 ;
Expand Down
2 changes: 1 addition & 1 deletion pkg/docker-engine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export PKG_RPM_RELEASE = 3
PKG_LIST ?= deb rpm static
# supported platforms: https://github.com/moby/moby/blob/master/docker-bake.hcl#L93-L101
# 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 windows/amd64
PKG_PLATFORMS ?= linux/amd64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/arm64 linux/s390x windows/amd64

.PHONY: default
default: pkg ;
Expand Down