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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include vars.mk
include common/vars.mk

pkgs := $(notdir $(shell find "pkg/" -maxdepth 1 -type d))

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ and are published as a Docker image on Docker Hub.

## Usage

`vars.mk` contains variables that will be used by the main `Makefile` and
also across projects in [pkg](pkg) folder. It contains the list of apk,
deb and rpm releases to produce and repos with current versions of projects.
`common` folder contains helpers that will be used by the main `Makefile` and
also across projects in [pkg](pkg) folder like the list of supported apk, deb
and rpm releases to produce and repos with current versions of projects.

`Makefile` contains targets to build specific or all packages and will output
to `./bin` folder:
Expand Down
55 changes: 55 additions & 0 deletions common/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2022 Docker Packaging authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

define run_bake
@PKG_RELEASE=$(1) DESTDIR=$(2) docker buildx bake $(3) $(4) --print
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX))
PKG_RELEASE=$(1) DESTDIR=$($@_TMP_OUT) docker buildx bake $(3) $(4)
mkdir -p $(2)
find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(2)/ ';'
find $(2) -type d -empty -delete
rm -rf "$($@_TMP_OUT)"
endef

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

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

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

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

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

.PHONY: pkg-cross-static
pkg-cross-static:
$(MAKE) build-cross-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)
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions vars.mk → common/vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ export DOCKER_CLI_VERSION ?= v20.10.17
export BUILDX_VERSION ?= v0.9.1
export COMPOSE_VERSION ?= v2.10.2
export CREDENTIAL_HELPERS_VERSION ?= v0.7.0-beta.1

define run_bake
@PKG_RELEASE=$(1) DESTDIR=$(2) docker buildx bake $(3) $(4) --print
PKG_RELEASE=$(1) DESTDIR=$(2) docker buildx bake $(3) $(4)
endef
44 changes: 4 additions & 40 deletions pkg/buildx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include ../../vars.mk
include ../../common/vars.mk

DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../packages.hcl
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= apk deb rpm static
DEFAULT_RULE ?= pkg-cross

Expand All @@ -31,41 +31,5 @@ all-%: $(DEFAULT_RULE)-%
version:
@echo $(BUILDX_VERSION)

include ../../packages.mk

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

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

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

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

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

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

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

.PHONY: build-cross-%
build-cross-%: pkg-info-%
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX))
$(call run_bake,$*,$($@_TMP_OUT),$(BAKE_DEFINITIONS),pkg-cross)
mkdir -p $(DESTDIR)
find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(DESTDIR)/ ';'
find $(DESTDIR) -type d -empty -delete
rm -rf "$($@_TMP_OUT)"
include ../../common/packages.mk
include ../../common/build.mk
3 changes: 2 additions & 1 deletion pkg/buildx/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ group "default" {
target "_common" {
inherits = ["_pkg-${PKG_RELEASE}"]
args = {
BUILDKIT_MULTI_PLATFORM = 1
BUILDX_REPO = BUILDX_REPO
BUILDX_VERSION = BUILDX_VERSION
PKG_NAME = PKG_NAME
Expand Down Expand Up @@ -127,7 +128,7 @@ group "pkg-cross" {
# $ docker buildx bake release --push --set *.tags=docker/packaging:build-v0.9.1
target "release" {
inherits = ["meta-helper", "_platforms"]
dockerfile = "../../release.Dockerfile"
dockerfile = "../../common/release.Dockerfile"
target = "release"
contexts = {
bin-folder = "./bin"
Expand Down
44 changes: 4 additions & 40 deletions pkg/compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include ../../vars.mk
include ../../common/vars.mk

DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../packages.hcl
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= apk deb rpm static
DEFAULT_RULE ?= pkg-cross

Expand All @@ -31,41 +31,5 @@ all-%: $(DEFAULT_RULE)-%
version:
@echo $(COMPOSE_VERSION)

include ../../packages.mk

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

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

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

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

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

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

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

.PHONY: build-cross-%
build-cross-%: pkg-info-%
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX))
$(call run_bake,$*,$($@_TMP_OUT),$(BAKE_DEFINITIONS),pkg-cross)
mkdir -p $(DESTDIR)
find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(DESTDIR)/ ';'
find $(DESTDIR) -type d -empty -delete
rm -rf "$($@_TMP_OUT)"
include ../../common/packages.mk
include ../../common/build.mk
3 changes: 2 additions & 1 deletion pkg/compose/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ group "default" {
target "_common" {
inherits = ["_pkg-${PKG_RELEASE}"]
args = {
BUILDKIT_MULTI_PLATFORM = 1
COMPOSE_REPO = COMPOSE_REPO
COMPOSE_VERSION = COMPOSE_VERSION
PKG_NAME = PKG_NAME
Expand Down Expand Up @@ -127,7 +128,7 @@ group "pkg-cross" {
# $ docker buildx bake release --push --set *.tags=docker/packaging:compose-v2.10.2
target "release" {
inherits = ["meta-helper", "_platforms"]
dockerfile = "../../release.Dockerfile"
dockerfile = "../../common/release.Dockerfile"
target = "release"
contexts = {
bin-folder = "./bin"
Expand Down
44 changes: 4 additions & 40 deletions pkg/credential-helpers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include ../../vars.mk
include ../../common/vars.mk

DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../packages.hcl
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= deb rpm static
DEFAULT_RULE ?= pkg

Expand All @@ -31,41 +31,5 @@ all-%: $(DEFAULT_RULE)-%
version:
@echo $(CREDENTIAL_HELPERS_VERSION)

include ../../packages.mk

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

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

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

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

.PHONY: pkg-%
pkg-cross-%: pkg-%-releases
$(call run_bake,$*,$(DESTDIR),$(BAKE_DEFINITIONS),pkg)

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

.PHONY: build-%
build-%: pkg-info-%
PKG_RELEASE=$* DESTDIR=$(DESTDIR) docker buildx bake $(BAKE_DEFINITIONS) pkg

.PHONY: build-cross-%
build-cross-%: pkg-info-%
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX))
$(call run_bake,$*,$($@_TMP_OUT),$(BAKE_DEFINITIONS),pkg-cross)
mkdir -p $(DESTDIR)
find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(DESTDIR)/ ';'
find $(DESTDIR) -type d -empty -delete
rm -rf "$($@_TMP_OUT)"
include ../../common/packages.mk
include ../../common/build.mk
3 changes: 2 additions & 1 deletion pkg/credential-helpers/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ group "default" {
target "_common" {
inherits = ["_pkg-${PKG_RELEASE}"]
args = {
BUILDKIT_MULTI_PLATFORM = 1
CREDENTIAL_HELPERS_REPO = CREDENTIAL_HELPERS_REPO
CREDENTIAL_HELPERS_VERSION = CREDENTIAL_HELPERS_VERSION
GO_IMAGE = GO_IMAGE
Expand Down Expand Up @@ -155,7 +156,7 @@ target "meta-helper" {
# $ docker buildx bake release --push --set *.tags=docker/packaging:credential-helpers-v0.7.0-beta.1
target "release" {
inherits = ["meta-helper", "_platforms"]
dockerfile = "../../release.Dockerfile"
dockerfile = "../../common/release.Dockerfile"
target = "release"
contexts = {
bin-folder = "./bin"
Expand Down
44 changes: 4 additions & 40 deletions pkg/docker-cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include ../../vars.mk
include ../../common/vars.mk

DESTDIR ?= $(BASEDIR)/bin
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../packages.hcl
BAKE_DEFINITIONS ?= -f docker-bake.hcl -f ../../common/packages.hcl
PKG_LIST ?= deb rpm static
DEFAULT_RULE ?= pkg

Expand All @@ -34,41 +34,5 @@ all-%: $(DEFAULT_RULE)-%
version:
@echo $(DOCKER_CLI_VERSION)

include ../../packages.mk

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

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

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

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

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

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

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

.PHONY: build-cross-%
build-cross-%: pkg-info-%
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-packaging.XXXXXXXXXX))
$(call run_bake,$*,$($@_TMP_OUT),$(BAKE_DEFINITIONS),pkg-cross)
mkdir -p $(DESTDIR)
find $($@_TMP_OUT) -mindepth 2 -maxdepth 2 -type d -exec cp -rf {} $(DESTDIR)/ ';'
find $(DESTDIR) -type d -empty -delete
rm -rf "$($@_TMP_OUT)"
include ../../common/packages.mk
include ../../common/build.mk
3 changes: 2 additions & 1 deletion pkg/docker-cli/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ group "default" {
target "_common" {
inherits = ["_pkg-${PKG_RELEASE}"]
args = {
BUILDKIT_MULTI_PLATFORM = 1
DOCKER_CLI_REPO = DOCKER_CLI_REPO
DOCKER_CLI_VERSION = DOCKER_CLI_VERSION
GO_IMAGE = GO_IMAGE
Expand Down Expand Up @@ -155,7 +156,7 @@ target "meta-helper" {
# $ docker buildx bake release --push --set *.tags=docker/packaging:docker-cli-v20.10.17
target "release" {
inherits = ["meta-helper", "_platforms"]
dockerfile = "../../release.Dockerfile"
dockerfile = "../../common/release.Dockerfile"
target = "release"
contexts = {
bin-folder = "./bin"
Expand Down