Skip to content

Commit

Permalink
package/docker-cli-buildx: new package
Browse files Browse the repository at this point in the history
buildx is a docker CLI plugin implementing extended build features.

buildx is the default builder as of Docker v23.x, and if the plugin is not
present, the CLI will output an error warning that it is using the deprecated
built-in builder instead of the buildx builder.

However, buildx is a separate repository from docker-cli: it is a plugin that
needs to be installed at /usr/lib/docker/cli-plugins on the target.

https://github.com/docker/buildx

Signed-off-by: Christian Stewart <christian@aperture.us>

---

v1 -> v2:

 - buildx: bump version to v0.11.1
 - https://github.com/docker/buildx/releases/tag/v0.11.1
 - NOTE: docker-cli-buildx requires language features from go1.20!
 - Depends on bump to go1.20.x:
   - https://patchwork.ozlabs.org/project/buildroot/patch/20230711220849.1702358-3-christian@aperture.us/

v2 -> v3:

 - Rename bin from buildx to docker-buildx (fixes docker cli not finding it)
 - update docker-cli-buildx to v0.11.2
   - https://github.com/docker/buildx/releases/tag/v0.11.2

Signed-off-by: Christian Stewart <christian@aperture.us>
  • Loading branch information
paralin committed Jul 28, 2023
1 parent 0226caa commit 9e536f6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,7 @@ menu "System tools"
source "package/ddrescue/Config.in"
source "package/debianutils/Config.in"
source "package/docker-cli/Config.in"
source "package/docker-cli-buildx/Config.in"
source "package/docker-compose/Config.in"
source "package/docker-engine/Config.in"
source "package/earlyoom/Config.in"
Expand Down
16 changes: 16 additions & 0 deletions package/docker-cli-buildx/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config BR2_PACKAGE_DOCKER_CLI_BUILDX
bool "docker-cli-buildx"
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_DOCKER_CLI
help
buildx is a Docker CLI plugin for extended build
capabilities with BuildKit.

https://github.com/docker/buildx

comment "docker-cli-buildx needs a toolchain w/ threads"
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
depends on !BR2_TOOLCHAIN_HAS_THREADS
3 changes: 3 additions & 0 deletions package/docker-cli-buildx/docker-cli-buildx.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Locally calculated
sha256 371eb742213ed580179fc4fdfd9a197f0e3115e91979b7907828427d578d49e5 docker-cli-buildx-0.11.2.tar.gz
sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
36 changes: 36 additions & 0 deletions package/docker-cli-buildx/docker-cli-buildx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
################################################################################
#
# docker-cli-buildx
#
################################################################################

DOCKER_CLI_BUILDX_VERSION = 0.11.2
DOCKER_CLI_BUILDX_SITE = $(call github,docker,buildx,v$(DOCKER_CLI_BUILDX_VERSION))

DOCKER_CLI_BUILDX_LICENSE = Apache-2.0
DOCKER_CLI_BUILDX_LICENSE_FILES = LICENSE

DOCKER_CLI_BUILDX_DEPENDENCIES = host-pkgconf

DOCKER_CLI_BUILDX_BUILD_TARGETS = cmd/buildx
DOCKER_CLI_BUILDX_GOMOD = github.com/docker/buildx

DOCKER_CLI_BUILDX_LDFLAGS = \
-X $(DOCKER_CLI_BUILDX_GOMOD)/version.Revision=$(DOCKER_CLI_BUILDX_VERSION) \
-X $(DOCKER_CLI_BUILDX_GOMOD)/version.Version=$(DOCKER_CLI_BUILDX_VERSION)

# create the go.mod file with required language version go1.20
# remove the conflicting vendor/modules.txt
# https://github.com/moby/moby/issues/44618#issuecomment-1343565705
define DOCKER_CLI_BUILDX_FIX_VENDORING
printf "module $(DOCKER_CLI_BUILDX_GOMOD)\n\ngo 1.20\n" > $(@D)/go.mod
rm -f $(@D)/vendor/modules.txt
endef
DOCKER_CLI_BUILDX_POST_EXTRACT_HOOKS += DOCKER_CLI_BUILDX_FIX_VENDORING

define DOCKER_CLI_BUILDX_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/bin/buildx \
$(TARGET_DIR)/usr/lib/docker/cli-plugins/docker-buildx
endef

$(eval $(golang-package))

0 comments on commit 9e536f6

Please sign in to comment.