From e8a82ed24de073ccf3191b0d5b3df3d2b1f69903 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 29 Dec 2022 15:35:55 +0100 Subject: [PATCH] Dockerfile: add "all" stage to build binaries and extra tools We still need a stage that build binaries and extra tools as well for docker-ce-packaging repo: https://github.com/docker/docker-ce-packaging/blob/ff110508ffce04a9246ef52af4e7a458422e941a/static/Makefile#L41-L57 This could be removed if we create a package for each project like it's done in docker-packaging repo: https://github.com/docker/packaging/tree/main/pkg Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 2 +- Dockerfile | 11 +++++++++++ docker-bake.hcl | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88952bb973..8ff824328b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: name: Build uses: docker/bake-action@v2 with: - targets: binary + targets: all set: | *.platform=${{ matrix.platform }} - diff --git a/Dockerfile b/Dockerfile index 1d0a42b149..d21fe8cf9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -597,6 +597,17 @@ EOT FROM scratch AS binary COPY --from=build /build/ / +# usage: +# > docker buildx bake all +FROM scratch AS all +COPY --from=tini /build/ / +COPY --from=runc /build/ / +COPY --from=containerd /build/ / +COPY --from=rootlesskit /build/ / +COPY --from=containerutil /build/ / +COPY --from=vpnkit / / +COPY --from=build /build / + # usage: # > make shell # > SYSTEMD=true make shell diff --git a/docker-bake.hcl b/docker-bake.hcl index 98e02cca98..95c1c6bcff 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -124,6 +124,20 @@ target "binary-cross" { inherits = ["binary", "_platforms"] } +# +# same as binary but with extra tools as well (containerd, runc, ...) +# + +target "all" { + inherits = ["_common"] + target = "all" + output = [bindir(DOCKER_STATIC == "1" ? "binary" : "dynbinary")] +} + +target "all-cross" { + inherits = ["all", "_platforms"] +} + # # dev #