Skip to content

Commit

Permalink
Merge pull request #24 from crazy-max/rename-multi
Browse files Browse the repository at this point in the history
rename cross targets to multi and update docs
  • Loading branch information
crazy-max committed Sep 19, 2022
2 parents a5a493f + 4702880 commit 8d7cf3f
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 61 deletions.
18 changes: 17 additions & 1 deletion README.md
Expand Up @@ -28,7 +28,23 @@ $ make deb rpm
```

Each [project](pkg) has also its own `Makefile`, `Dockerfile` and bake
definition to build and push packages in two steps:
definition to build and push packages.

```shell
$ cd pkg/buildx/
# build all packages matching host platform (shortand for pkg-apk pkg-deb pkg-rpm pkg-static)
$ make pkg
# build all packages for all supported platforms (shortand for pkg-multi-apk pkg-multi-deb pkg-multi-rpm pkg-multi-static)
$ make pkg-multi
# build debian packages for all supported platforms
$ make pkg-multi-deb
# build debian bullseye packages matching host platform
$ make build-debian11
# build centos 7 packages for all supported platforms
$ make build-multi-centos7
```

To create a new release of Buildx v0.9.1:

```shell
# build all packages for buildx v0.9.1 and output to ./bin folder
Expand Down
22 changes: 11 additions & 11 deletions common/build.mk
Expand Up @@ -34,22 +34,22 @@ pkg-%: pkg-%-releases
pkg-static:
$(MAKE) build-static

.PHONY: pkg-cross
pkg-cross:
$(MAKE) $(foreach pkg,$(PKG_LIST),pkg-cross-$(pkg))
.PHONY: pkg-multi
pkg-multi:
$(MAKE) $(foreach pkg,$(PKG_LIST),pkg-multi-$(pkg))

.PHONY: pkg-%
pkg-cross-%: pkg-%-releases
$(MAKE) $(foreach release,$(PKG_RELEASES),build-cross-$(release))
pkg-multi-%: pkg-%-releases
$(MAKE) $(foreach release,$(PKG_RELEASES),build-multi-$(release))

.PHONY: pkg-cross-static
pkg-cross-static:
$(MAKE) build-cross-static
.PHONY: pkg-multi-static
pkg-multi-static:
$(MAKE) build-multi-static

.PHONY: build-%
build-%: pkg-info-%
$(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg)

.PHONY: build-cross-%
build-cross-%: pkg-info-%
$(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg-cross)
.PHONY: build-multi-%
build-multi-%: pkg-info-%
$(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg-multi)
2 changes: 1 addition & 1 deletion pkg/buildx/Makefile
Expand Up @@ -17,7 +17,7 @@ include ../../common/vars.mk
DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= apk deb rpm static
DEFAULT_RULE ?= pkg-cross
DEFAULT_RULE ?= pkg-multi

.PHONY: all
all: $(DEFAULT_RULE)
Expand Down
22 changes: 11 additions & 11 deletions pkg/buildx/docker-bake.hcl
Expand Up @@ -118,13 +118,13 @@ group "pkg" {
}

# Same as pkg but for all supported platforms
group "pkg-cross" {
targets = [substr(BUILDX_VERSION, 0, 1) == "#" ? "_pkg-build-cross" : "_pkg-download-cross"]
group "pkg-multi" {
targets = [substr(BUILDX_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"]
}

# Create release image by using ./bin folder as named context. Therefore
# pkg or pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg or pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:build-v0.9.1
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand All @@ -142,9 +142,9 @@ target "_pkg-download" {
output = [bindir("local")]
}

target "_pkg-download-cross" {
target "_pkg-download-multi" {
inherits = ["_pkg-download", "_platforms"]
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_pkg-build" {
Expand All @@ -159,16 +159,16 @@ target "_pkg-build" {
output = [bindir("local")]
}

target "_pkg-build-cross" {
inherits = ["_pkg-download-cross"]
target "_pkg-build-multi" {
inherits = ["_pkg-download-multi"]
args = {
MODE = "build"
BUILDX_VERSION = trimprefix(BUILDX_VERSION, "#")
}
contexts = {
build = "target:_build-cross"
build = "target:_build-multi"
}
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_build" {
Expand All @@ -181,6 +181,6 @@ target "_build" {
target = "binaries"
}

target "_build-cross" {
target "_build-multi" {
inherits = ["build", "_platforms"]
}
2 changes: 1 addition & 1 deletion pkg/compose/Makefile
Expand Up @@ -17,7 +17,7 @@ include ../../common/vars.mk
DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= apk deb rpm static
DEFAULT_RULE ?= pkg-cross
DEFAULT_RULE ?= pkg-multi

.PHONY: all
all: $(DEFAULT_RULE)
Expand Down
22 changes: 11 additions & 11 deletions pkg/compose/docker-bake.hcl
Expand Up @@ -118,13 +118,13 @@ group "pkg" {
}

# Same as pkg but for all supported platforms
group "pkg-cross" {
targets = [substr(COMPOSE_VERSION, 0, 1) == "#" ? "_pkg-build-cross" : "_pkg-download-cross"]
group "pkg-multi" {
targets = [substr(COMPOSE_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"]
}

# Create release image by using ./bin folder as named context. Therefore
# pkg or pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg or pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:compose-v2.10.2
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand All @@ -142,9 +142,9 @@ target "_pkg-download" {
output = [bindir("local")]
}

target "_pkg-download-cross" {
target "_pkg-download-multi" {
inherits = ["_pkg-download", "_platforms"]
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_pkg-build" {
Expand All @@ -159,16 +159,16 @@ target "_pkg-build" {
output = [bindir("local")]
}

target "_pkg-build-cross" {
inherits = ["_pkg-download-cross"]
target "_pkg-build-multi" {
inherits = ["_pkg-download-multi"]
args = {
MODE = "build"
COMPOSE_VERSION = trimprefix(COMPOSE_VERSION, "#")
}
contexts = {
build = "target:_build-cross"
build = "target:_build-multi"
}
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_build" {
Expand All @@ -181,6 +181,6 @@ target "_build" {
target = "binary"
}

target "_build-cross" {
target "_build-multi" {
inherits = ["build", "_platforms"]
}
6 changes: 3 additions & 3 deletions pkg/containerd/docker-bake.hcl
Expand Up @@ -162,7 +162,7 @@ target "pkg" {
}

# Same as pkg but for all supported platforms
target "pkg-cross" {
target "pkg-multi" {
inherits = ["pkg", "_platforms"]
}

Expand All @@ -172,8 +172,8 @@ target "meta-helper" {
}

# Create release image by using ./bin folder as named context. Therefore
# pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:containerd-v1.6.8
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand Down
6 changes: 3 additions & 3 deletions pkg/credential-helpers/docker-bake.hcl
Expand Up @@ -148,7 +148,7 @@ target "pkg" {
}

# Same as pkg but for all supported platforms
target "pkg-cross" {
target "pkg-multi" {
inherits = ["pkg", "_platforms"]
}

Expand All @@ -158,8 +158,8 @@ target "meta-helper" {
}

# Create release image by using ./bin folder as named context. Therefore
# pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:credential-helpers-v0.7.0-beta.1
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand Down
6 changes: 3 additions & 3 deletions pkg/docker-cli/docker-bake.hcl
Expand Up @@ -148,7 +148,7 @@ target "pkg" {
}

# Same as pkg but for all supported platforms
target "pkg-cross" {
target "pkg-multi" {
inherits = ["pkg", "_platforms"]
}

Expand All @@ -158,8 +158,8 @@ target "meta-helper" {
}

# Create release image by using ./bin folder as named context. Therefore
# pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:docker-cli-v20.10.17
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand Down
6 changes: 3 additions & 3 deletions pkg/docker-engine/docker-bake.hcl
Expand Up @@ -145,7 +145,7 @@ target "pkg" {
}

# Same as pkg but for all supported platforms
target "pkg-cross" {
target "pkg-multi" {
inherits = ["pkg", "_platforms"]
}

Expand All @@ -155,8 +155,8 @@ target "meta-helper" {
}

# Create release image by using ./bin folder as named context. Therefore
# pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:docker-engine-v20.10.17
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand Down
2 changes: 1 addition & 1 deletion pkg/scan/Makefile
Expand Up @@ -17,7 +17,7 @@ include ../../common/vars.mk
DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= apk deb rpm static
DEFAULT_RULE ?= pkg-cross
DEFAULT_RULE ?= pkg-multi

.PHONY: all
all: $(DEFAULT_RULE)
Expand Down
24 changes: 12 additions & 12 deletions pkg/scan/docker-bake.hcl
Expand Up @@ -112,13 +112,13 @@ group "pkg" {
}

# Same as pkg but for all supported platforms
group "pkg-cross" {
targets = [substr(SCAN_VERSION, 0, 1) == "#" ? "_pkg-build-cross" : "_pkg-download-cross"]
group "pkg-multi" {
targets = [substr(SCAN_VERSION, 0, 1) == "#" ? "_pkg-build-multi" : "_pkg-download-multi"]
}

# Create release image by using ./bin folder as named context. Therefore
# pkg or pkg-cross target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-cross
# pkg or pkg-multi target must be run before using this target:
# $ PKG_RELEASE=debian11 docker buildx bake pkg-multi
# $ docker buildx bake release --push --set *.tags=docker/packaging:build-v0.9.1
target "release" {
inherits = ["meta-helper", "_platforms"]
Expand All @@ -136,9 +136,9 @@ target "_pkg-download" {
output = [bindir("local")]
}

target "_pkg-download-cross" {
target "_pkg-download-multi" {
inherits = ["_pkg-download", "_platforms"]
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_pkg-build" {
Expand All @@ -153,16 +153,16 @@ target "_pkg-build" {
output = [bindir("local")]
}

target "_pkg-build-cross" {
inherits = ["_pkg-download-cross"]
target "_pkg-build-multi" {
inherits = ["_pkg-download-multi"]
args = {
MODE = "build"
SCAN_VERSION = trimprefix(SCAN_VERSION, "#")
}
contexts = {
build = "target:_build-cross"
build = "target:_build-multi"
}
output = [bindir("cross")]
output = [bindir("multi")]
}

target "_build" {
Expand All @@ -172,9 +172,9 @@ target "_build" {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
BUILDKIT_MULTI_PLATFORM = 1
}
target = "cross"
target = "multi"
}

target "_build-cross" {
target "_build-multi" {
inherits = ["build", "_platforms"]
}

0 comments on commit 8d7cf3f

Please sign in to comment.