Explorar o código

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 <crazy-max@users.noreply.github.com>
(cherry picked from commit e8a82ed24de073ccf3191b0d5b3df3d2b1f69903)
CrazyMax %!s(int64=2) %!d(string=hai) anos
pai
achega
2dd577955c
Modificáronse 3 ficheiros con 26 adicións e 1 borrados
  1. 1 1
      .github/workflows/ci.yml
  2. 11 0
      Dockerfile
  3. 14 0
      docker-bake.hcl

+ 1 - 1
.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 }}
       -

+ 11 - 0
Dockerfile

@@ -599,6 +599,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

+ 14 - 0
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
 #